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

How do you implement default text for a search box in WPF?

I want to implement something exactly like "Changing the Default Text in the Search Box" for a WPF search TextBox. The box should show some greyed out "Search.." text when it's empty, and then it should function normally when text is typed in. The…
Yostage
  • 292
  • 2
  • 4
  • 12
7
votes
3 answers

Vim search and highlighting control from a script

I'm writing a script in which I want to control searches programmatically, and get them highlighted. The search() function results are not highlighted (I think), so using that function is not of use to me. What I want to do is use the 'normal /'…
Herbert Sitz
  • 21,858
  • 9
  • 50
  • 54
7
votes
3 answers

How do I search within a selected block of code with vim

say, I want to search for a particular text withing a function block. The present way, that i am implementing is selecting the block of code from within the function brackets with vi{ and then copying it and pasting it to a new file. After that I am…
isnvi23h4
  • 1,910
  • 1
  • 27
  • 45
7
votes
3 answers

Searching at frontend vs backend in NodeJS

I am developing a web application using NodeJS & SailsJS frameworks. Now I am going to develop searching functionality. There are around 5000 records from which I want to search on one attribute. I know I can search it using mogodb query. What if I…
user3759750
  • 123
  • 3
  • 10
7
votes
3 answers

Windows Search using OLE DB SQL Fields

I need to use Windows Search within my .NET application to search for certain files containing certain keywords. All of this seams easy enough using OLE DB to connect to the Windows Search data store on Windows 7. I have what I hope is a seriously…
Iain Kelwick
  • 201
  • 2
  • 7
7
votes
1 answer

Search for multiple strings in several files with Sublime 3 using AND

This previous (similar) question of mine Search for multiple strings in several files with Sublime 3 was answered with a way to search for multiple strings in multiple files in SublimeText, using the regex OR operator: Find: (string1|string2) Where:…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
7
votes
1 answer

python imaplib search with multiple criteria

I'm trying to use the search function and am running into an issue. I can download all attachments from a gmail account and sort them according to the file extension. I have all of that code working right except when I add extra criteria to the…
Jeff
  • 103
  • 1
  • 2
  • 6
7
votes
2 answers

to_tsvector is empty if any column has no data in PostgreSQL Full Text Search

I am trying to implement a Postgre SQL Full Text Search but I am running into a problem with the entire document returning empty if any of the columns set with to_tsvector are empty. I have a table that looks like the following: id | title | …
knsheely
  • 543
  • 5
  • 13
7
votes
7 answers

Filter array elements by searching for partial match in keys and values

is it possible to do searching in PHP array same we do in MySQL. Eg: I have this array array( 'mark@test.com'=> `Mark Mian`, 'jhon@test.com'=> `John jack`, 'logon@test.com'=> `Bob Logon`, 'Stela@test.com'=> `Stela Josh`, 'json@test.com'=>…
Qazi
  • 5,015
  • 8
  • 42
  • 62
7
votes
1 answer

Where to put model search logic in a Rails application?

I'm trying to figure out the "best" place to put multi-attribute search form logic in a Rails application. The search form in question has several attributes which may or may not have values, and the data types differ between attributes. (For…
Chris Hart
  • 2,153
  • 1
  • 23
  • 45
7
votes
1 answer

Woocommerce Search by Attributes

I am facing a little problem with the default woocommerce search system. I need to open a WooCommerce based Book Store. ALl The books contain unique properties like Identification No and ODN or IBN. Now i need a search bar which gives me the result…
Fahad Sohail
  • 1,818
  • 4
  • 21
  • 33
7
votes
1 answer

Modifying elasticsearch score based on nested field value

I want to modify scoring in ElasticSearch (v2+) based on the weight of a field in a nested object within an array. For instance, using this data: PUT index/test/0 { "name": "red bell pepper", "words": [ {"text": "pepper", "weight":…
HotStuff68
  • 925
  • 1
  • 10
  • 13
7
votes
2 answers

Zend Lucene MoreLikeThis

I'm using Zend_Search_Lucene for my search engine. Sadly it is missing an implementation of the MorelikeThis methods which can find similar documents in the index. Has anybody come across a decent Zend port of this function? I found a drupal module…
Neil Aitken
  • 7,856
  • 3
  • 41
  • 40
7
votes
1 answer

Error in searching specific post_type form post_type column using WooCommerce product search

I am using this code to search products from a Wordpress/WooCommerce website. My requirment is URL will be like "http://localhost/wp/?s=D34&post_type=product" While s=D34 is search string. When user will search for a string. Data will be searched…
Adnan Ali
  • 2,851
  • 5
  • 22
  • 39
7
votes
1 answer

Django Haystack substring search

I have recently added search capabilities to my django-powered site to allow employers to search for employees using keywords. When the user initially uploads their resume, I turn it into text, get rid of stop words, and then add the text to a…
dpetters
  • 163
  • 4
  • 15
1 2 3
99
100