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

Fastest and most efficient way of searching a key-value pair in Java?

DISCLAIMER: This question was not meant to be argumentative! What is fastest and less memory draining way of searching a key-value pair? I will be storing items in a key-value like relation and I need to access them quickly. Should I use a SQLite…
Mohit Deshpande
  • 53,877
  • 76
  • 193
  • 251
10
votes
2 answers

How do I find words starting with a specific letter?

I want to find words which start with a specific letter in a string using the following code. The specific letter would be supplied by the user in a text box. This is what I have:
codesam
  • 105
  • 1
  • 1
  • 4
10
votes
2 answers

django-haystack ordering - How do I handle this?

I'm using django-haystack for a search page on my site. I'm basically done, but not quite happy with the ordering and not quite sure how haystack decides how to order everything. I know I can over-ride the SearchQuerySet by using order_by but that…
Bartek
  • 15,269
  • 2
  • 58
  • 65
10
votes
7 answers

TicTacToe strategic reduction

I decided to write a small program that solves TicTacToe in order to try out the effect of some pruning techniques on a trivial game. The full game tree using minimax to solve it only ends up with 549,946 possible games. With alpha-beta pruning,…
Nick Larsen
  • 18,631
  • 6
  • 67
  • 96
10
votes
8 answers

C# Finding relevant document snippets for search result display

In developing search for a site I am building, I decided to go the cheap and quick way and use Microsoft Sql Server's Full Text Search engine instead of something more robust like Lucene.Net. One of the features I would like to have, though, is…
CleverPatrick
  • 9,261
  • 5
  • 63
  • 86
10
votes
5 answers

Search by order item SKU or ID in WooCommerce Orders Admin page

What I am trying to do is to be able to search by order item SKU or ID in the WooCommerce Orders Admin page. What I have found/done till now, but with no success is the following at functions.php file. add_filter(…
Nikos
  • 111
  • 1
  • 7
10
votes
3 answers

emacs org mode, search only headers

In emacs, I want to be able to search only the 'headers' in an org mode file. Idea 1: Search only Visible I could achieve this by hiding everything, then showing only the outline (S-TAB, S-TAB) and then maybe search all that is visible.(in this…
Leo Ufimtsev
  • 6,240
  • 5
  • 40
  • 48
10
votes
2 answers

search widget is not working in release apk

I'm having a strange issue(for me at least). my app works fine with debug apk. but when I create release apk then it shows error in searchwidget. I'm using support library 'com.android.support:appcompat-v7:21.0.3' this is my code @Override public…
akshay bhange
  • 2,320
  • 2
  • 28
  • 46
10
votes
1 answer

urllink in Sitecore indexs returns media url with "/sitecore/shell/~/media/..."

"urllink" is a ComputedIndexField in Sitecore indexs. Foe media items, if I rebuild the indexs, the urls that gets stored into index start with "/~/media/...", which is correct. But if the index strategy is onPublishEndSync, and I do republish on my…
zhanke
  • 671
  • 7
  • 25
10
votes
7 answers

Crawl specific pages and data and make it searchable

Important note: the questions below aren't meant to break ANY data copyrights. All crawled and saved data is being linked directly to the source. For a client I'm gathering information for building a search engine/web spider combination. I do have…
Joshua - Pendo
  • 4,331
  • 6
  • 37
  • 51
10
votes
2 answers

Python: searching csv and return entire row

I couldn´t find a better place to ask my question. I am learning Python and trying to create a script as follows. 1) Should be able to search csv file. 2) Return entire row if match is found. My…
Meigo62
  • 163
  • 1
  • 2
  • 12
10
votes
1 answer

How do I set up a facet search with a many to many relationship using Sunspot?

I haven't implemented a search feature before and feel a bit stuck. I have a Sunspot search feature which finds results based on keywords - this works great - but I now want to implement the multi select facet feature, but I can't even seem to…
10
votes
2 answers

Design Pattern for Drilldown / Filtered Search

I'm looking to build a powerful search feature for a site, similar to NewEgg's drilldown search, e.g., http://www.newegg.com/Product/ProductList.aspx?Submit=ENE&N=2010150014%201035507776&name=7200%20RPM I'm working with a variety of objects similar…
Kirk Ouimet
  • 27,280
  • 43
  • 127
  • 177
10
votes
1 answer

How to use minimum_should_match to search in multiple fields?

I'm trying to filter my elasticsearch's result, it must return the results which are 80% compatible with the search text. When I do this for just one key, the minimum_should_match works perfect: { "size":30, "from":930, …
Alessandro Gomes
  • 521
  • 1
  • 5
  • 14
10
votes
2 answers

What does the beam size represent in the beam search algorithm?

I have a question about the beam search algorithm. Let's say that n = 2 (the number of nodes we are going to expand from every node). So, at the beginning, we only have the root, with 2 nodes that we expand from it. Now, from those two nodes, we…
Dimitar Spasovski
  • 2,023
  • 9
  • 29
  • 45