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

how to find specific xml data by attribute name/value in flex / actionscript

From some xml I want to find items that have a specific attribute and value. Here is example xml: dont want this one
Scott Szretter
  • 3,938
  • 11
  • 57
  • 76
10
votes
10 answers

Finding division by zero in a big project

Recently, our big project began crashing on unhandled division by zero. No recent code seems to contain any likely elements so it may be new data sets affecting old code. The problem is the code base is pretty big, and running on an embedded device…
SF.
  • 13,549
  • 14
  • 71
  • 107
10
votes
2 answers

Implementing search in a Ruby on Rails 3 application?

I am writing my first Ruby on Rails application and need to implement a "search" feature. It will need to search the database (1 column per table in 3 different tables), and return the most relevant results in each of the 3 categories. Kind of like…
Andrew
  • 227,796
  • 193
  • 515
  • 708
10
votes
4 answers

Quick MSDN Search in Firefox

Is there a way to get an MSDN search bar in Firefox which will autocomplete .Net class and member names (and preferably also Win32 API methods) and take me directly to the MSDN page? Google toolbar with Shift+Enter (I'm feeling lucky) will usually…
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
10
votes
17 answers

Recursion binary search in Python

I have a list with numbers from 0-9: mylist = list(range(10)) I am getting an error with the division command to get mid: def binary_search(mylist, element, low, high): low=0 high= len(mylist) mid=low + (high- mymin)/2 if…
user2898221
  • 157
  • 1
  • 2
  • 6
10
votes
3 answers

Explain Tkinter text search method

I don't quite understand how text.search method works. For example there is a sentence: Today a red car appeared in the park. I need to find a red car sequence and highlight it. It is found but here is how my highlighting looks like: I am using…
minerals
  • 6,090
  • 17
  • 62
  • 107
10
votes
3 answers

Multiple LIKE in sqlite

I'm trying to create a search function. If the search input field is "foo bar", I split it into two keywords then do this query: SELECT p.* FROM p_extra_fields as x INNER JOIN products as p ON x.product = p.id WHERE x.type = "1" AND ( …
Anna K.
  • 1,887
  • 6
  • 26
  • 38
10
votes
3 answers

Boolean Logic (Order of operations) A and B or C

I am creating a "Basic Search" bar that users can type in terms. I am unsure of the order of operations for boolean logic. If someone types terms(With no quotes): A and B or C What is the correct way to treat this? (A and B) or (C) OR (A) and (B or…
Max87
  • 109
  • 1
  • 1
  • 3
10
votes
2 answers

How can I create a search functionality with partial view in asp.net mvc 4

I am using ASP.NET MVC 4 with entity framework model first. In my "Masterpage.cshtml" I want to have a partial view which contains a textbox and a button. The search is looking for the items title, if the text contains a items title it should…
Obsivus
  • 8,231
  • 13
  • 52
  • 97
10
votes
1 answer

Multithreaded A* Search in Java or Lisp or C#

Is there a good way to do a multithreaded A* search? Single threaded is fairly easy, as given in (for example) Artificial Intelligence: A Modern Approach, but I have not come across a good multithreaded version. Assume a sane language like Java or…
Adam Goode
  • 7,380
  • 3
  • 29
  • 33
10
votes
6 answers

ActionBar SearchView not fully expanding in landscape mode

When using the action bar search interface, the widget expands to occupy the full width of the screen in portrait mode, but stops short in landscape mode. Is there a way to set the expansion layout params on the SearchView to fully fill the action…
Collin Buchan
  • 257
  • 1
  • 3
  • 9
10
votes
2 answers

Google similar image search API

I'm trying to find out if there is a way to do google similar image searches via an API? I know the image search api is depreciated but is it still useable? https://developers.google.com/image-search/ Also... It seems that you can do image searches…
Joe Hamilton
  • 665
  • 2
  • 9
  • 19
10
votes
9 answers

Use cmd prompt to search a word on google or other search engine

I am trying to use a programming language to search google or another specified search engine. I would like to use windows cmd prompt to do so because the specified programming language has a simple command to access the cmd prompt. Any ideas on…
Pareto
  • 169
  • 1
  • 1
  • 8
10
votes
2 answers

What is search.twitter.com's "trending topics" algorithm?

What algorithm does twitter use to determine the 10 topics that you can see at search.twitter.com? I would like to implement that algorithm and I would also like to show the 50 most popular topics (instead of 10). Can you describe the most efficient…
quilby
10
votes
10 answers

Most efficient way to process a large csv in .NET

Forgive my noobiness but I just need some guidance and I can't find another question that answers this. I have a fairly large csv file (~300k rows) and I need to determine for a given input, whether any line in the csv begins with that input. I…
user1981003
  • 103
  • 1
  • 1
  • 6