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
2 answers

existential search and query without the fuss

Is there an extensible, efficient way to write existential statements in Haskell without implementing an embedded logic programming language? Oftentimes when I'm implementing algorithms, I want to express existentially quantified first-order…
emi
  • 5,380
  • 1
  • 27
  • 45
9
votes
2 answers

MySQL: How to find where a specific primary key is used as a foreign key in other tables?

I'm working on implementing a function to prevent removal of certain elements in a database (through the front end) if they have other items associated with them in other tables. Otherwise those other tables are looking for keys that aren't…
spuriosity
  • 273
  • 5
  • 16
9
votes
3 answers

LINQ contains one match from array of strings

Having trouble getting this to work: /// /// Retrieve search suggestions from previous searches /// public static string[] getSearchSuggestions(int SectionID, string Query) { string[] Suggestions; …
Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
9
votes
1 answer

pattern found in vim search, but not in vim search and replace?

There is a search and replace operation I am trying to do using backreferencing and regular expressions in vim. Interestingly, it will only recognize the pattern if I do a pure search, but if I do a search and replace it gives me an E486: pattern…
bhh1988
  • 1,262
  • 3
  • 15
  • 30
9
votes
2 answers

Check if Android device has search hardware button

I need help figuring out how to check if a device is equipped with the search hardware button or not. Is this possible? EDIT: I'm talking about finding out if the device has the search hardware button or not. Simple question. Each android device has…
ScratchMyTail
  • 281
  • 3
  • 10
9
votes
1 answer

Gmail Filter Based on Contact Label

I have a bunch of contacts associated with a label in gmail. I would like to set up a filter to label or delete all messages not associated with those contacts in the label. Has anyone found a way to do this? Example https://snipboard.io/wLvuZt.jpg
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
9
votes
3 answers

Relevancy using Oracle Text

I want to implement a relevancy based text search on News text. Here is the requirement. A table will contain the news text in an Oracle table column of type CLOB. The search will retrieve the news article based on relevancy of the user entered…
cosmos
  • 2,414
  • 4
  • 23
  • 25
9
votes
2 answers

Is there a way to easily search for / list template repositories on Github?

Is there a way to easily search for / list template repositories on Github? Templates are quite interesting because they allow to create a new project from a, well, template without having to get all the history with it. An example with Spring Boot…
jlengrand
  • 12,152
  • 14
  • 57
  • 87
9
votes
1 answer

vscode navigate search editor using keyboard only

Is there any way to navigate the search editor (whole workspace search) using only cursor keys in vscode ? I'm talking about the whole workspace search and not just the find/replace search.
pandith padaya
  • 1,643
  • 1
  • 10
  • 20
9
votes
5 answers

How to search inside a specific block of code in IntelliJ IDEA?

How I can search within a specific block of code or selection in IntelliJ IDEA? I got used to using this feature in Eclipse. In Eclipse you can just double click on the beginning of a curly bracket, and it'll highlight the entire block of code.…
Khon Lieu
  • 4,295
  • 7
  • 37
  • 39
9
votes
3 answers

Is Full Text search the answer?

OK I have a mySQL Database that looks something like this ID - an int and the unique ID of the recorded Title - The name of the item Description - The items description I want to search both title and description of key words, currently I'm…
user70568
9
votes
1 answer

Search a github project, but avoid "test" directories?

Is there any way to exclude certain directories when searching a particular github project? In a large project on Github like nodejs, I often want to search the source code to find where in the project something is defined. A challenge I regularly…
jfriend00
  • 683,504
  • 96
  • 985
  • 979
9
votes
1 answer

Amazon API search results vs. Amazon.com search results

For our web app, which will use Amazon's API as a basis for some of the site's main interactions, we required the ability to do a generalized search of Amazon's products and return results based on relevancy. The expectation was that their API would…
dclowd9901
  • 6,756
  • 9
  • 44
  • 63
9
votes
3 answers

Index is not getting created, text index required for $text query - mongoose

mongoose: 5.8.9 node: v12.13.0 After setting up to create index on the schema, mongoose doesn't create the index, After creating a new document there is only ID index nothing newly created. I had done as the document mentioned for creating index…
U.A
  • 2,991
  • 3
  • 24
  • 36
9
votes
5 answers

How to quickly search book titles?

I have a database of about 200k books. I wish to give my users a way to quickly search a book by the title. Now, some titles might have prefix like A, THE, etc. and also can have numbers in the title, so search for 12 should match books with "12",…
Milan Babuškov
  • 59,775
  • 49
  • 126
  • 179