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

Rails Active Record Search - Name includes a word

Im trying to pull all records from a Project model that includes in the project_name the word 'Fox'. I can do an active record search and return specific project_names, like 'Brown Fox': @projects = Project.where("project_name like ?", "Brown…
JakeTy
  • 145
  • 2
  • 8
9
votes
3 answers

Sort Wordpress Search by Relevance

I've created a pretty advanced search for a Wordpress site I'm working on atm. Allowing visitors to filter results by different taxonomies, sort them by date or custom fields as well as the normal free text search (which WP offers by default). I've…
powerbuoy
  • 12,460
  • 7
  • 48
  • 78
9
votes
2 answers

Google Custom Search API Search Image by Image URL

I am working on an application which will have an option for users to upload images. Once uploaded, the application will show other images from the web which look exactly similar, whether or not of the same size. For this, I will create a temporary…
Naveed Hasan
  • 641
  • 7
  • 19
9
votes
6 answers

JQuery hide all divs except for the divs I search for

I want to create a search input for users to quickly find teachers for my school. The above is a horizontal scrollbar containing a lot of teachers. Every teacher in the scrollbar is wrapped in a seperate div called staff-container.
Brett Merrifield
  • 2,220
  • 6
  • 22
  • 21
9
votes
1 answer

Writing a very basic search form in Django

So I'm trying to get something very simple accomplished. I want to enter a term into my search box, and display it on the resulting page. My HTML for the form is
9
votes
1 answer

findstr command to find a phrase instead of a single word

findstr /S "stored procedure" *.* returns all the files with the string "stored" as opposed to "stored procedure". Does anyone know what I am doing wrong? Thanks
user1298925
  • 2,304
  • 7
  • 29
  • 43
9
votes
4 answers

Calculating Manhattan Distance in Python in an 8-Puzzle game

I am trying to code a simple A* solver in Python for a simple 8-Puzzle game. I have represented the goal of my game in this way: goal = [[1, 2, 3], [8, 0, 4], [7, 6, 5]] My problem is that I don't know how to write a simple…
JohnQ
  • 1,073
  • 2
  • 10
  • 17
9
votes
1 answer

Boyer-Moore-Horspool Algorithm for All Matches (Find Byte array inside Byte array)

Here is my implementation of BMH algorithm (it works like a charm): public static Int64 IndexOf(this Byte[] value, Byte[] pattern) { if (value == null) throw new ArgumentNullException("value"); if (pattern == null) throw new…
Tommaso Belluzzo
  • 23,232
  • 8
  • 74
  • 98
9
votes
2 answers

What is the technology behind bing? Its own version of map-reduce algorithm or something else?

Bing's search hits are quite impressive, has Microsoft not let anyone in on behind the scenes of their search technology? Tried http://www.discoverbing.com but couldn't find the answer to my question.
Murali VP
  • 6,198
  • 4
  • 28
  • 36
9
votes
2 answers

How to add distinct values in a multivalue field in solr

I have a multivalue field called category(which is also a store field) in which i need to add only distinct values value1 value2 If I do a update as follows
Jagadesh
  • 6,489
  • 8
  • 29
  • 30
9
votes
1 answer

Android Search widget - difference between onQueryTextSubmit and sending Intent to SearchableActivity?

I have an activity that contains a SearchView widget. I am handling the results of the text search using an onQueryTextSubmit listener, and this works fine. (The activity itself is designated as a Searchable Activity). I recently decided to add…
abeliangrape
  • 577
  • 4
  • 15
9
votes
1 answer

whats the fastest string collection structure/algorithm for startswith and/or contains searches

I have the following situation: I have a big collection of strings (lets say 250.000+) of average length of maybe 30. What I have to do is to do many searches within these .. mostly those will be of StartsWith and Contains kind. The collection is…
Mikk
  • 331
  • 4
  • 13
9
votes
1 answer

How to get more than one field with django filter icontains

I am trying to compare my query search to all my model fields, but I can't figure how to do it in more than one field. this is my code. expense = Expense.objects.filter(user=request.user.id).order_by('date') q = request.GET['q'] result =…
yaniv14
  • 691
  • 1
  • 10
  • 24
9
votes
3 answers

Python module for searching patent databases, ie USPTO or EPO

For my work i have to find potential customers in biomedical research and industry. I wrote some pretty handy programs using the module biopython, which has a nice interface for searching NCBI. I have also used the clinical_trials module, to search…
Misconstruction
  • 1,839
  • 4
  • 17
  • 23
9
votes
4 answers

Is there a way to get emacs's anything to do "fuzzy" searches?

I'm not sure if fuzzy is the correct way to phrase this, so allow me to explain what I want to do. Often times, I'm looking for files that I know are within a particular directory in my local SVN working copy, and I have an idea what directory…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510