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

SOLR - How to have facet counts restricted to rows returned in resultset

/select/?q=*:*&rows=100&facet=on&facet.field=category I have around 100 000 documents indexed. But I return only 100 documents using rows=100. The facet counts returned for category, however return the counts for all documents indexed. Can we…
user489895
  • 131
  • 1
  • 10
10
votes
2 answers

How to use Select box outside to filter dataTables?

I'm using the DataTables Table plug-in for jQuery but I'm having trouble getting the global input search box would be an select box. With the sDOM option lrtip, filtering input is not show but is it possible to display select box and getting the…
LeMoussel
  • 5,290
  • 12
  • 69
  • 122
10
votes
6 answers

optimize search through large js string array?

if I have a large javascript string array that has over 10,000 elements, how do I quickly search through it? Right now I have a javascript string array that stores the description of a job, and I"m allowing the user to dynamic filter the returned…
TriFu
  • 641
  • 3
  • 10
  • 19
10
votes
2 answers

jqGrid: using multiple methods to filter data

My requirement is to show a page with multiple filters to apply to grid data. Suppose we are talking about Orders and an order has the following attributes public class Order { public int OrderID public DateTime OrderDate public DateTime…
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
10
votes
4 answers

Implementation of the bidirectional graph search

I am trying to implement a bi-directional graph search. As I understand, I should somehow merge two breadth-first searches, one which starts at the starting (or root) node and one which starts at the goal (or end) node. The bi-directional search…
10
votes
2 answers

How to search and replace text in an XML file using Python?

How do I search an entire xml file for a specific text pattern and then replace each occurrence of that text with new text pattern in Python 3.5? Everything else (format, attributes, comments, etc.) needs to remain as it is in the original xml…
AJK
  • 113
  • 1
  • 1
  • 5
10
votes
2 answers

Searching a sequence in a NumPy array

Let's say I have the following array : array([2, 0, 0, 1, 0, 1, 0, 0]) How do I get the indices where I have occurrence of sequence of values : [0,0]? So, the expected output for such a case would be : [1,2,6,7]. Edit : 1) Please note that [0,0]…
sten
  • 7,028
  • 9
  • 41
  • 63
10
votes
4 answers

How to exclude file from PhpStorm global search (Ctrl+Shift+F)

I want to exclude a file from the PhpStorm global search (Ctrl+Shift+F) but not exclude the file from the project itself. A good use case would be to avoid searching inside files like jQuery.js, but in my particular case, I have a plugin that…
santiago arizti
  • 4,175
  • 3
  • 37
  • 50
10
votes
2 answers

SandCastle Help Builder: Search Functionality

I'm very happy with the output from SandCastle, but I would also like to have some search functionality included in the HTML output, is this possible?
Michael L
  • 5,560
  • 7
  • 29
  • 32
10
votes
1 answer

How to increase google custom search quota for image search beyond 10000?

The app I work on has previously used the Google Image Search API to allow users to search for images to use in their document. The API has been deprecated for a long time, and google finally pulled the plug on it, which meant that we had to move to…
Thayne
  • 6,619
  • 2
  • 42
  • 67
10
votes
2 answers

optimize snmp library to search a device ip address in iphone

I'm using Mobile snmp++ library (https://github.com/Zchander/mobile-snmp-plusplus/tree/master/Mobile%20SNMP%2B%2B) in iPhone app to scan devices using swift language. The Mobile Snmp++ library is written in Objective-C and with Bridging header I'm…
sia
  • 1,872
  • 1
  • 23
  • 54
10
votes
4 answers

Free database of Google word frequencies?

On the Stackoverflow podcast this week, Jeff mentioned that in 2004 he wrote a script which queried Google with 110,000 English words and collected a database containing the number of hits for each word. They use this on Stackoverflow e.g. for the…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
10
votes
2 answers

Computing mid in Interpolation Search?

I came to know that Interpolation Search is a modification of Binary Search where in binary search the input is divided into two equal halves in each iteration by computing mid = (low + high) / 2 and in Interpolation search the mid is computed…
Antara Roy
  • 475
  • 1
  • 7
  • 14
10
votes
6 answers

Finding the furthest point in a grid when compared to other points

I have a rectangular grid of variable size but averaging 500x500 with a small number of x,y points in it (less than 5). I need to find an algorithm that returns an x,y pair that is the farthest away possible from any of the other points. Context:…
Julian
  • 8,808
  • 8
  • 51
  • 90
10
votes
3 answers

Wordpress get_posts if keyword exists in title, content or tag

I am using get_posts to get a list of posts that match a search keyword, the problem is that I the get_posts's s parameter does not search tags by default and using tag_slug__in will not work if the keyword is found in the title and not in a…
Stefan Dunn
  • 5,363
  • 7
  • 48
  • 84