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

Visual Studio: Is there an incremental search for the entire solution?

I am very fond of the keyboard shortcuts built into Visual Studio. One of my favorites is Ctrl+i, which triggers the incremental search. It jumps over the text in the current document as I fill in the searchword. After the desired searchword is…
Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
10
votes
6 answers

Highlight a specific part of the text in SwiftUI

Hello I'm new to Swift and am using SwiftUI for my project where I download some weather data and I display it in the ContentView(). I would like to highlight some part of the Text if it contains some specific word, but I don't have any idea how to…
Damiano Miazzi
  • 1,514
  • 1
  • 16
  • 38
10
votes
1 answer

EditText needs clicking twice to open search dialog

My application has two EditText elements. Both implement the OnClickListener like this: editText1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Open search dialog doSomeStuff(); …
Robert Strauch
  • 12,055
  • 24
  • 120
  • 192
10
votes
5 answers

Is there a search engine that will give a direct answer?

I've been wondering about this for a while and I can't see why Google haven't tried it yet - or maybe they have and I just don't know about it. Is there a search engine that you can type a question into which will give you a single answer rather…
10
votes
3 answers

Is there a way to modify fetched results with a predicate after they are initialized?

I am trying to build a search view for an existing CoreData app (simple logging app). I have all the data stored with CoreData and is fetched with the @FetchRequest: @State private var searchPredicate: NSPredicate? = NSPredicate(format: "title…
Jannis
  • 175
  • 10
10
votes
3 answers

Different results using Bing.com and Bing Search API

I'm using the Bing Search API 2.0 (XML) & PHP to retreive results. But when running some queries, the API doesn't return the (same) results Bing.com would. When I send this request: (This is using the…
Adam Lynch
  • 3,341
  • 5
  • 36
  • 66
10
votes
3 answers

Search for bitstring most unlike a set of bitstrings

I have a set of bitstrings: {'0011', '1100', '1110'} (all bitstrings within a set are of same length). I want to quickly find the bitstring of same length that has the smallest max-similarity to the set. Max-similarity can be computed as such: def…
RoyM
  • 735
  • 3
  • 14
10
votes
3 answers

Given a list of words and a sentence find all words that appear in the sentence either in whole or as a substring

Problem Given a list of string find the strings from the list that appear in the given text. Example list = ['red', 'hello', 'how are you', 'hey', 'deployed'] text = 'hello, This is shared right? how are you doing tonight' result = ['red', 'how…
thebenman
  • 1,621
  • 14
  • 35
10
votes
2 answers

SEO consequences of redirecting with META REFRESH

Question: What are the SEO consequences of redirecting web traffic with a META REFRESH? Details: I'm working with an old static site that's migrating to a new address. I'm redirecting traffic to the new site using meta refreshes on all static pages,…
Sam
  • 2,152
  • 6
  • 31
  • 44
10
votes
4 answers

Fast text editor find

Does anyone know how text editors/programmers editors are able to do such fast searches on very large text files. Are they indexing on load, at the start of the find or some other clever technique? I desperately need a faster implementation of what…
Andy
  • 739
  • 1
  • 9
  • 18
10
votes
6 answers

Search of Dictionary Keys python

I want to know how I could perform some kind of index on keys from a python dictionary. The dictionary holds approx. 400,000 items, so I am trying to avoid a linear search. Basically, I am trying to find if the userinput is inside any of the dict…
Trent
  • 1,275
  • 7
  • 17
  • 22
10
votes
3 answers

Python: How to do a system wide search for a file when just the filename (not path) is available

I'm still new to Python (using 2.6) and I am trying to do a system wide search for a file when just the filename is available and return the absolute path on windows. I've searched and found some modules like scriptutil.py and looked through the os…
ldmvcd
  • 968
  • 3
  • 10
  • 15
10
votes
5 answers

Android implement search with view model and live data

I'm working on a project in android for a udacity course I'm currently trying to implement a search function while adhering to android architecture components and using firestore and room I'm fairly new to all these concepts so please point out…
martinseal1987
  • 1,862
  • 8
  • 44
  • 77
10
votes
4 answers

Flutter search bar with autocomplete

I'm looking for a search bar in flutter docs but can't find it, is there a widget for the search bar with autocomplete in appbar. For example, I have a search icon on my appbar. When one press it show's the search box, when you type it should show…
azra abdullah
  • 139
  • 1
  • 5
  • 12
10
votes
6 answers

Find an array (byte[]) inside another array?

What is the simplest way to find a byte[] inside another byte[]? i have a feeling i could do it with linq but i dont know how. Note: I did a search with the [c#] and didnt find anything, i am surprised.
user34537