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

Does string exist check 20k times

I have an ITunes library XML file backup file - about 15 MB. I have 20K music files on my C drive and about 25K files on E drive under exactly similar folder structures. I am traversing the first location and going file by file and checking if the…
Raj More
  • 47,048
  • 33
  • 131
  • 198
9
votes
1 answer

Performance impact of using a string of length 100 characters as _Id column in Elastic Search

I am planning to store events in elastic search. It can have around 100 million events at any point time. To de-dupe events, I am planning to create _id column of length 100 chars by concatenating below fields entity_id - UUID (37 chars) +…
Harish
  • 7,589
  • 10
  • 36
  • 47
9
votes
1 answer

How to use Windows Search Service in c#

I'm working on an application, an user can search for files or folders either on the local computer or on the network. I am using DirectoryInfo.GetDirecotories(). But I also want to add the functionality that windows 7 uses for searching, I believe…
user4031277
9
votes
1 answer

Open Layers 3 search functionality to find a map location?

What is the best way to implement a search functionality into an OL3 map? I need a search input that will show me a few options while searching and then pan and zoom to the specific search term. Pretty much like google maps do. Do I need to…
Nicolas T
  • 327
  • 1
  • 5
  • 15
9
votes
1 answer

Sunspot highlights not appearing

I've gone through the docs in github: http://github.com/outoftime/sunspot to find solutions for highlighting, but it doesn't seem to work for me. My Job model has something like this block (omitted some fields on purpose): searchable do text…
maricris-sn
  • 158
  • 9
9
votes
1 answer

How to search by duration in Algolia

Let's say I am building a hotel booking platform, and every Room record has availability calendar. A common search criteria is to search by duration. Where user inputs start date and end date, and database fetches rooms that are not occupied from…
Chris Yeung
  • 2,613
  • 6
  • 34
  • 57
9
votes
1 answer

Solving a puzzle using search algorithms

I came across a puzzle a few days ago. It's solvable easily by hand. But I was trying to build an algorithm for solving it. But i dont know how I should proceed. Here you can see that i have to connect all pairs of colored dots. For example i need…
Shubhashis
  • 10,411
  • 11
  • 33
  • 48
9
votes
2 answers

jQuery Datatables : Searching and filtering with Ajax pagination

I have a SQL table with 36000 entries to show in a Datatables list. The pagination works well since I develop it like this : var table = $('.datatable').DataTable({ pageLength : 20, lengthChange : false, processing : true, serverSide…
Pauloscorps
  • 564
  • 1
  • 6
  • 16
9
votes
1 answer

Custom metadata for elasticsearch documents

I was wandering what is the best way to add custom metadata for documents in elasticsearch. Lets say I have a document of type Test "Test": { "properties": { "TestName": { "type":…
Lital Kolog
  • 1,301
  • 14
  • 39
9
votes
1 answer

How to throw 2 eggs from a building and find the floor F with ~c*sqrt(F) throws?

I am reading Robert Sedgewick's algorithms 4th edition book, and he has the following task: Suppose that you have an N-story building and 2 eggs. Suppose also that an egg is broken if it is thrown off floor F or higher, and unbroken otherwise. Your…
9
votes
5 answers

How to search for a text? (MySQL)

I have this table: bussId | nameEn | keywords 500 name1 name2 keyword1 keyword2 I want to return bussId 5000 if the user search for (keyword1 or keyword2 or name2 or name1). So I should use this query…
david
  • 3,310
  • 7
  • 36
  • 59
9
votes
2 answers

Flask-Sqlalchemy + Sqlalchemy-searchable returning empty list

First time on the site, so hi to all and thanks in advance. Longtime lurker and newb. I'm working on a web app in flask, using Flask-SqlAlchemy and SqlAlchemy-Searchable (docs-> https://sqlalchemy-searchable.readthedocs.org/en/latest/index.html).…
Vyndion
  • 151
  • 8
9
votes
3 answers

searching a namedtuple like a dictionary

to conserve memory & avoid redundant DB storage (yes possibly pre-optimizing), I'm using namedtuple instead of dictionary. But I need to search the collection of recs and my dictionary approach is: import operator def query(D,key,val,…
Dewey
  • 756
  • 6
  • 17
9
votes
0 answers

Emacs org-mode: search visible content only, not collapsed?

In Emacs org-mode, I sometimes do sparse tree searches to list only headlines that match a tag. I would like to be able to search only what is currently visible (matching headlines), not the whole buffer as does Isearch. Is this possible natively or…
Leo Ufimtsev
  • 6,240
  • 5
  • 40
  • 48
9
votes
3 answers

How to find files according RegEx in C#

I need to get list of files on some drive with paths that matches specific pattern, for example FA\d\d\d\d.xml where \d is digit (0,1,2..9). So files can have names like FA5423.xml. What is the most efficient name to do this?
bao
  • 111
  • 1
  • 2
  • 5