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

Rails: How do I search tags generated by Act_As_Taggable_On with PG_Search? (postgresql)

I am currently using Act_as_taggable_on for tagging and pg_search to search through my postgresql database on my Rails 3 application. How would I search through tags generated by the act_as_taggable_on gem with pg_search? I can view the tags of a…
kibaekr
  • 1,319
  • 1
  • 21
  • 38
10
votes
9 answers

Automatically increment filename

Right now I have this code: int number = 0; DirectoryInfo di = new DirectoryInfo(scpath + @"Screenshots\"); if (di.Exists) { } else { di.Create(); } int screenWidth = Screen.GetBounds(new Point(0, 0)).Width; int screenHeight =…
David Brewer
  • 1,864
  • 8
  • 25
  • 37
10
votes
3 answers

How to search column_names in Vertica?

Anyone know of a handy function to search through column_names in Vertica? From the documentation, it seems like \d only queries table_names. I'm looking for something like MySQL's information_schema.columns, but can't find any information about a…
timssopomo
  • 113
  • 1
  • 1
  • 6
9
votes
7 answers

How can I quickly search all included header files in a project for a specific symbol?

Here's a problem I've had recently that just HAS to be a common pain to others here. I'm working with someone else's legacy C code and need to find where a function or macro was defined. The code #includes a bunch of different standard system…
JJC
  • 9,547
  • 8
  • 48
  • 53
9
votes
5 answers

More efficient method of getting Directory size

I've already build a recursive function to get the directory size of a folder path. It works, however with the growing number of directories I have to search through (and number of files in each respective folder), this is a very slow, inefficient…
ikathegreat
  • 2,311
  • 9
  • 49
  • 80
9
votes
1 answer

Is there any way for me to change scoring based on term position in Lucene?

for example, if I am searching an index of book titles with the term "harry", "Dirty Harry" is scored equally to "Harry Potter", and when two items are equally scored, the order is random. I'd like to weight the one that begins with my search term…
HaterTot
  • 407
  • 8
  • 18
9
votes
5 answers

Lucene: Multi-word phrases as search terms

I'm trying to make a searchable phone/local business directory using Apache Lucene. I have fields for street name, business name, phone number etc. The problem that I'm having is that when I try to search by street where the street name has…
RikSaunderson
  • 3,505
  • 6
  • 32
  • 50
9
votes
1 answer

Xapian vs Apache Solr

I'm trying to get a good natural language search going in a website, and trying to understand the advantages of Apache Solr vs Xapian. Xapian seems easier to set up. Do both offer good natural language searches? Any insight appreciated.
user4231
9
votes
1 answer

SQL search with logical operators

I have a asp.net web application that needs a search page that searches for data in a specific table (SQL). Today it only has a simple LIKE query, useing parametized sql: SqlParameter[] param = new SqlParameter[1]; param[0] = new…
Paaland
  • 682
  • 1
  • 10
  • 25
9
votes
1 answer

View-based NSTableView filtering + animation

I have a view based NSTableView that I sometimes filter using NSPredicate. Is there any way to animate the items being removed/added/reordered throughout the tableview to have the same effect as beginUpdates, endUpdates and…
Alex Zielenski
  • 3,591
  • 1
  • 26
  • 44
9
votes
5 answers

Range lookup in Java

Suppose, I have an unsorted array of overlapped ranges. Each range is just a pair of integers begin and end. Now I want to find if a given key belongs to at least one of the ranges. Probably, I have to know the ranges it belongs as well. We can…
Michael
  • 41,026
  • 70
  • 193
  • 341
9
votes
3 answers

Performing search in Asp.net MVC

I am new to Asp.net MVC and have no idea as to how can i perform the search. Here's my requirement, please tell me how will you handle this :- I need to have textbox where user can enter a search query or string. The user then clicks on a button or…
Pankaj Upadhyay
  • 12,966
  • 24
  • 73
  • 104
9
votes
4 answers

Find specific text in multiple TXT files in PHP

I want to find a specific text string in one or more text files in a directory, but I don't know how. I have Googled quite a long time now and I haven't found anything. Therefor I'm asking you guys how I can fix this? Thanks in advance.
Airikr
  • 6,258
  • 15
  • 59
  • 110
9
votes
4 answers

case insensitive string search - iphone

I am looking for a way to perform a case insensitive string search within another string in Objective-C. I could find ways to search case sensitive strings, and to compare insensitive case, but not searching + case insensitive. Examples of the…
TommyG
  • 4,145
  • 10
  • 42
  • 66
9
votes
2 answers

How does Google Chrome suggest url completions?

I've learned about Google's (unofficial) suggest API and their search API, which both look really great, but the suggest API doesn't actually suggest navigational completions. On the other hand, in Google Chrome if you start to type for example…
devios1
  • 36,899
  • 45
  • 162
  • 260