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

Core Data: Interrupt executing NSFetchRequest

Been searching high and low for this: In Core Data, is there a way to interrupt/stop/cancel and executing NSFetchRequest? I'm implementing an incremental search in an iPhone app, and I've tried every way of optimizing it, but it's not enough (I have…
mclin
  • 3,599
  • 1
  • 20
  • 18
9
votes
2 answers

Django Full Text Search Not Matching Partial Words

I'm using Django Full Text search to search across multiple fields but have an issue when searching using partial strings. Lets say we have a report object with the name 'Sample Report'. vector = SearchVector('name') +…
Bryden Fogelman
  • 103
  • 1
  • 2
  • 5
9
votes
4 answers

How would I search for text that contains emojis?

We have a MySQL InnoDB table, with a text field COLLATE utf8mb4_unicode_ci. I need to search for rows that contain any emoji characters. I've searched through quite a few SO questions, but people seem to have a list of emojis they are searching for.…
Stefan
  • 700
  • 10
  • 22
9
votes
1 answer

Speeding up calculation of nearby groups?

I have a data frame that contains a group ID, two distance measures (longitude/latitude type measure), and a value. For a given set of distances, I want to find the number of other groups nearby, and the average values of those other groups nearby.…
user1566200
  • 1,826
  • 4
  • 27
  • 47
9
votes
7 answers

Searching within Xcode

I've had some problems with searching in Xcode, what is the best way to find and locate a method or class within a certain project?
user532668
9
votes
2 answers

Uniform Cost Search in Python

I have implemented a simple graph data structure in Python with the following structure below. The code is here just to clarify what the functions/variables mean, but they are pretty self-explanatory so you can skip reading it. # Node data…
Luke Collins
  • 1,433
  • 3
  • 18
  • 36
9
votes
3 answers

Tiddlywiki: make a list of all tiddlers tagged with name of current tiddler

If I have a tiddler named "X", I know I can make a list of all tiddlers tagged with "X" by using <>. Is there a way to make a no-brainer macro which automatically finds all tiddlers nested under the…
crypdick
  • 16,152
  • 7
  • 51
  • 74
9
votes
6 answers

How do I force a Rails query to return potentially two models per result?

I'm using Rails 5. I have this in my controller model for loading a certain model subject to criteria ... @results = MyObjectTime.joins(:my_object, "LEFT JOIN user_my_object_time_matches on my_object_times.id =…
Dave
  • 15,639
  • 133
  • 442
  • 830
9
votes
4 answers

What Algorithm is using in Chrome search?

Assume you are using Chrome, when I press Cmd+F or Ctrl + F... I type a char, it searches the whole page and highlight the text for me. It searches instantly. What kind of algorithm is Chrome using? Why it can type and search so fast? any ideas on…
Tattat
  • 15,548
  • 33
  • 87
  • 138
9
votes
5 answers

How to find nearest vector in {0,1,2}^12, over and over again

I'm searching a space of vectors of length 12, with entries 0, 1, 2. For example, one such vector is 001122001122. I have about a thousand good vectors, and about a thousand bad vectors. For each bad vector I need to locate the closest good…
Josephine
  • 1,409
  • 1
  • 9
  • 11
9
votes
2 answers

How to escape things within zend literal?

I'm creating an advanced search and wanted to loop through my queries by adding them to an array like so: private $searchFields = [ 'as_first_name' => 'users.first_name like "%VALUE%"', 'as_last_name' =>…
hamobi
  • 7,940
  • 4
  • 35
  • 64
9
votes
2 answers

Finding duplicates in Elasticsearch

I'm trying to find entries in my data which are equal in more than one aspect. I currently do this using a complex query which nests aggregations: { "size": 0, "aggs": { "duplicateFIELD1": { "terms": { "field": "FIELD1", …
Alfe
  • 56,346
  • 20
  • 107
  • 159
9
votes
1 answer

Query MongoDB with $and and Multiple $or

As stated in the documentation, this is not possible. AND Queries With Multiple Expressions Specifying the Same Operator Consider the following example: db.inventory.find( { $and : [ { $or : [ { price : 0.99 }, { price : 1.99 } ] }, …
juminoz
  • 3,168
  • 7
  • 35
  • 52
9
votes
1 answer

Windows Search - IFilter search term highlighting

My development team are having a problem having snippets of text shown for search results in windows 7 for our own custom files (note we are NOT talking about the preview pane that uses the IPreviewHandler interface). An example of what I mean for…
Jamie
  • 3,150
  • 2
  • 26
  • 35
9
votes
4 answers

javascript check if an element content some part of an array

I have an array like this var ALLOW_SUBNET = ['192.168.1.', '192.168.2.', '192.168.3.' , '192.168.4.']; And I can get IP address of PC Client by using my own function: getIPClient() var ipclient = input.getIPClient(); My question is how can I…