Questions tagged [search]

Questions about search algorithm mechanics and implementation. *NOT* for questions about using search tools within an API (e.g. Google, Bing, Facebook).

Searching is one of the most common and important tasks in Computer Science.

The most basic search algorithm is a (also called "sequential search"). Each item in a collection of data is examined in sequence until the sought item is found.

If the collection in question has already been sorted, for instance, then a more efficient is possible.

Search can become more complex when, rather than finding one instance of a specific item, we want to find all items meeting a certain set of criteria. For instance a query can specify extremely complex search criteria, and much of relational database design involves the planning of an efficient way to perform those searches.

Another more complex search scenario is graph search, in which a series of nodes and edges must be traversed. Common algorithms for this domain include and . In many cases, a heuristic search algorithm such as can achieve more efficient results by making use of additional information about the problem.


Do not use this tag for questions about specific search tools within an API. Some more relevant tags for that would be the following:

37207 questions
9
votes
8 answers

How to search for all methods in a project that return implementation of Collection interface?

I've been reading Josh Bloch's 'Effective Java 2nd Edition'. Item 43 states 'Return empty arrays or collections, not nulls'. My question is how can I search for all methods in a project that return an implementation of java.util.Collection…
Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
9
votes
4 answers

Text Search for Rails 3 on Heroku - Texticle vs acts_as_tsearch vs acts_as_indexed

I am building a Rails 3 application that will be hosted on Heroku. To implement full text search, these are the free alternatives that I have come across: Texticle acts_as_tsearch acts_as_indexed My application is going to be data intensive with a…
Nirav Shah
  • 689
  • 6
  • 16
9
votes
2 answers

VScode: Is there a way to hide symlink results from Goto file.. (quick file open) in VScode? And search in general?

When one searches or uses the Goto file (Quick open) command (cmd+P), the search automatically includes everything from symlink folders. This makes the quick open literary useless if there is a significant symlink folder. Compare with Atom or…
CarvedBlock
  • 125
  • 1
  • 6
9
votes
6 answers

How can I create a search with multiple, optional, parameters using JavaScript?

What I currently have "works", however each parameter depends on the last. My goal was to allow the user to use any amount of the search fields to filter through posts, but can't seem to be able to wrap my head around how to actually execute…
Revircs
  • 1,312
  • 3
  • 12
  • 23
9
votes
2 answers

How to filter Pandas Dataframe rows which contains any string from a list?

I have dataframe that has values like those: A B ["I need avocado" "something"] ["something" "I eat margarina"] And I want to find rows that: In any column of the row, the column's value is contained in a list. for…
BestR
  • 669
  • 2
  • 6
  • 17
9
votes
6 answers

How do I SQL query for words with punctuation in Postgresql?

If I have strings/phrases like this stored in the database: What are Q-type Operations? Programmer's Guide A.B.C's of Coding Is there a way to pass a query parameter in like "Programmers" or "abc" or "q-type" and have it find "Programmer's",…
Lance
  • 75,200
  • 93
  • 289
  • 503
9
votes
2 answers

What's the fastest way to recursively search for files in python?

I need to generate a list of files with paths that contain a certain string by recursively searching. I'm doing this currently like this: for i in iglob(starting_directory+'/**/*', recursive=True): if filemask in i.split('\\')[-1]: # ignore…
Noise in the street
  • 589
  • 1
  • 6
  • 20
9
votes
3 answers

indices for more than one needle in Perl 6

I want to find indices for more than one letter in a word. I don't want to use Regexes, because they will slow down the program (which is already slower than I wanted). > "banana".indices(("a", "b").any) any((1 3 5), (0)) How can I instead get 0,…
Eugene Barsky
  • 5,780
  • 3
  • 17
  • 40
9
votes
2 answers

Fastest way to count all results in Lucene (java)

What is the fastest way to count all results for a given Query in Lucene? TopDocs.totalHits implement and manage a Filter, using QueryFilter implement a custom 'counting' Collector. This simply increments a count in the collect(int doc) method and…
npellow
  • 1,985
  • 1
  • 16
  • 23
9
votes
1 answer

Git shortlog, case insensitive and file stat search

I looking for a way to query the git log to list the number of edited (added, updated, deleted) files where the commit message matches a specific entry. I have started with this command.... git shortlog --grep="searchtopic" 1) How do I specify the…
Dilemmat_Dag
  • 383
  • 1
  • 4
  • 14
9
votes
2 answers

Search implementation: ElasticSearch vs MongoDB vs Relational Database

I am designing a big travel market agency, where I have 170000 hotels and 3000 room types. A simple representation of my entities is: Hotel: destination: Paris rooms: room_a: type: single room_b: type:…
iiirxs
  • 4,493
  • 2
  • 20
  • 35
9
votes
3 answers

Multiple SearchRecentSuggestionsProvider classes in Android app possible?

I have two different Search activities implemented with SearchManager in my app. One is the default searchable for the whole app and the other is used for only one activity. These two searches perform lookups of different data, and it doesn't make…
Marc Bernstein
  • 11,423
  • 5
  • 34
  • 32
9
votes
1 answer

How to increase alexa search results using alexa api

I am creating a java application which performs URL search for site : http://www.alexa.com/topsites/category User eneters a category name and my application displays all URL's and performs some operations. I am using this alexa api for URL…
Toman
  • 1,156
  • 1
  • 12
  • 29
9
votes
2 answers

elasticsearch add field to all documents

I'm new here. I have about 200 thousand documents in one index, all have same type. I want to add one more field "category" (which is a keyword string) to every single document. Is there a convenient way to achieve this? I know normally one query…
Nico
  • 733
  • 1
  • 6
  • 7
9
votes
2 answers

Elasticsearch equal SQL %Like%

Coming from here i'm asking myselve for the elasticsearch syntax for such querys: WHERE text LIKE "%quick%" AND text LIKE "%brown%" AND text LIKE "%fox%" my try (unfortunately without success) "query": { "bool": { "filter": [ …
Toshi
  • 2,532
  • 4
  • 17
  • 45