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

Find through multiple attributes in XML

I'm trying to search multiple attributes in XML :
Murtaza Mandvi
  • 10,708
  • 23
  • 74
  • 109
8
votes
2 answers

Javascript regex - how to get text between curly brackets

I need to get the text (if any) between curly brackets. I did find this other post but technically it wasn't answered correctly: Regular expression to extract text between either square or curly brackets It didn't actually say how to actually…
WastedSpace
  • 1,143
  • 6
  • 22
  • 34
8
votes
8 answers

Can there be an algorithm faster than linear search?

I have heard that there is no faster algorithm faster than linear search (for an unsorted array), but, when I run this algorithm (linear): public static void search(int[] arr, int value){ for(int i = 0; i < arr.length; i++){ if(arr[i] ==…
programmers5
  • 326
  • 2
  • 13
8
votes
0 answers

foursquare:venues/search?intent=browse returns more places when specifying categoryIds one by one than without categoryId

I use the venues/search endpoint of Foursquare to fetch all places around a point, within a given radius. For example, if I query without specifying any categoryId:…
Joseph Dureau
  • 151
  • 1
  • 3
8
votes
1 answer

How to implement single search form in yii2

Yii2 has a searchModel to search each field in the GridView. Is it possible to just create a single search field outside the GridView where the user can input keywords and by the time Search button is hit, the results will display in the GridView…
Ethelene Laverne
  • 279
  • 2
  • 6
  • 21
8
votes
3 answers

Searching partial strings PHP

How can you search a partial string when typing (not to use MySQL) like the LIKE function in MySQL but using PHP when searching a string, e.g.
MacMac
  • 34,294
  • 55
  • 151
  • 222
8
votes
2 answers

Angular material autocomplete search anywhere in string?

https://material.angularjs.org/latest/#/demo/material.components.autocomplete Please can someone tell me how to make autocomplete (Angular material) to search string not only at the beginning of words, but anywhere within the words. For example the…
Toni Kutlic
  • 83
  • 1
  • 5
8
votes
4 answers

Programmatically searching GMail?

Is there any way to programmatically search GMail, preferably using C#? For example, I'd like to get all email messages matching the search label:MyLabel from:no_reply@foo.bar, so that I can parse the email bodies as required. The only thing…
Mun
  • 14,098
  • 11
  • 59
  • 83
8
votes
2 answers

Searching a SQLite database which contains cyrillic data

I have a problem searching my SQLite database, which contains data written with cyrillic characters. If the key word is also cyrillic, then everything is ok, but if not, then I can`t get the result in my Android application. Does anyone have an…
user383295
  • 81
  • 2
8
votes
2 answers

ElasticSearch searching with hyphen inside a word

I would like to ask for a help. I want to search for a words inside the Title and Content. Here is the structure 'body' => array( 'mappings' => array( 'myindex' => array( '_source' => array( 'enabled' => true ), …
Sensini
  • 117
  • 1
  • 2
  • 7
8
votes
6 answers

Finding where source has branched from git

I have a git repository (covering more or less project history) and separate sources (just a tarball with few files) which have forked some time ago (actually somewhere in 2004 or 2005). The sources from tarball have undergone quite a lot of changes…
Michal Čihař
  • 9,799
  • 6
  • 49
  • 87
8
votes
1 answer

Postgres full text search: how to search multiple words in multiple fields?

i'm using for the first time Postgresql and i'm trying to create a search engine in my website. i have this table: CREATE TABLE shop ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, description TEXT, address TEXT NOT NULL, city TEXT NOT…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
8
votes
2 answers

elastic search exact phrase matching

I am new to ES. I am having trouble finding exact phrase matches. Let's assume my index has a field called movie_name. Let's assume I have 3 documents with the following values movie_name = Mad Max movie_name = mad max movie_name = mad max 3d If…
userab12345
  • 121
  • 1
  • 6
8
votes
5 answers

Efficient algorithm for finding a byte in a bit array

Given a bytearray uint8_t data[N] what is an efficient method to find a byte uint8_t search within it even if search is not octet aligned? i.e. the first three bits of search could be in data[i] and the next 5 bits in data[i+1]. My current method…
user80551
  • 1,134
  • 2
  • 15
  • 26
8
votes
2 answers

how to locate the center of a bright spot in an image?

Here is an example of the kinds of images I'll be dealing with: (source: csverma at pages.cs.wisc.edu) There is one bright spot on each ball. I want to locate the coordinates of the centre of the bright spot. How can I do it in Python or Matlab?…
Physicist
  • 2,848
  • 8
  • 33
  • 62