search

STL "closest" method?

I'm looking for an STL sort that returns the element "closest" to the target value if the exact value is not present in the container. It needs to be fast, so essentially I'm looking for a slightly modified binary search... I could write it, but it seems like something that should already exist... ...

File content via Solr to Lucene???

I have a question regarding searching a complete document. 1 - I have indexed a lot of documents on lucene. 2 - Each document has a single word per line. Suppose 200 words which becomes 200 lines. 3 - I know how to search lucene via Solr but; If suppose that i indexed the document mydoc.txt on lucene containing 200 words along with o...

Find the 2nd largest element in an array with minimum # of comparisom.

For an array of size N, what is the # of comparisons required? ...

Search for specific symbol inside array

$array = array('a', 'b', 'c', 'd', /*... letters from 3 alphabets*/); $letter = 'some symbol, posted by user'; // real length = 1 How to get know, is $letter one of the symbols, listed in $array? Like, if $letter = 'G' and there is no G in $array, well then return false. Yep, I tried in_array(), but there are too many symbols, is ...

Search engine against IEnumerable objects

Hi, We have a .NET application on which has grown beyond what we can develop in-house to search. We can certainly try to make the best search algorithm we can be it's not what we do and someone else has certainly done it better. We have an IEnumerable of object which has a title and a description and we'd like to search and rank it b...

Parsing / Splitting Keywords from Spatial / Location in Search

I'm trying to figure out a decent way to parse keywords from location words within a single string before or after geocoding the string or part of the string. For example: "iphone battery accessories toronto, on", or "2010 volvo 90210", or "circus texas", etc. It turns out I can pass the entire string to most geocoders and get a valid l...

How do i implement search on third level using containable behavior

Hi, I have developed a cake php application. In this there are tables like students,placements,batches,companies In placements table there is student_id,company_id and in students table there is batch_id column. In placements index page i have applied jq grid. Here is the screen shot. I want to give searching on student,company and...

How to display loading page before page with search results displays?

Usually when using any web page that is used to search for huge amount of data, like searching for cheap flights, user is first redirected to a page that shows progress bar e.g. 'Now Searching Multiple Travel Sites..', and when search on the server is done, then is redirected to actual search results. How that is done? Is it some javasc...

Simple search with Linq To SQL

What is the problem with this query and how can I fix it? public JsonResult Find(string q) { var k = new List<string>(q.Split(' ')); return Json(_dataContext.Jobs .OrderBy(p => new List<string>(p.Keywords.Split(' ')).Where(n => k.Contains(n)).Count()) .Select(p => new { p.Title, p.IsFullTime, p.Location, p.Categ...

Drupal - mixed taxonomy and keyword search

Hi all, I'm sure I found a similar question on here the other day with no definite answer - now I can't find it to reference it. A simplistic version of what I'm trying to achieve would be a couple of selects in the form: color: red, blue or green flavor: apple, pear, banana and a keyword text box. That's it, but I can't work out how ...

How to develop a keyword matching application

I'll list what I'm planning to do and need pointers on how to go about building it. I have millions of business records. New businesses are added everyday. Every time a new Business is added, we need to determine if the particular business already exists. We query our database and search for businesses with matching keywords as entered ...

How do I get of the most common words in various languages?

Stackoverflow implemented its "Related Questions" feature by taking the title of the current question being asked and removing from it the 10,000 most common English words according to Google. The remaining words are then submitted as a fulltext search to find related questions. How do I get such a list of the most common English words?...

Creating complex-featurerich yet comprehensive user-intuitive search forms with .net riaservices

I need to make some complex, feature rich search forms for my silverlight application, but I need to do it in a way that the user understands, so it's not only me as a developer who thinks that it's really smart. Are there any guidelines or guides that can help me to do this? I think I've created the form and erased it 3 times now, I rea...

SQL server 2008 - storing and searching URL (web address)

I'm facing a decision on how to store URL (bookmark) in a table. I have following requirements: Customer must be able to search the title of a bookmark. I decided to use a FTS with ranking option for this requirement Customer must be able to search an address Here is where I have doubts on how to store URL. First of all, UR...

How can live search / search suggestions be implemented using Dojo?

I want to implement a 'live search' or 'search suggestions' feature in a web application that uses the Dojo Framework. It would be similar to the way Google and Bing searches display matches as you type: when you type in the search box, a list of potential matches appears below. Searches would be performed server side, with the results s...

Twitter Live Search

I was trying to reverse engineer Twitter-Live Search. Maybe we could discuss it here. I am talking about the feature where Tweets are shown even latest to "1 sec ago" etc. Trying to understand how the following might happen - There must be some layer between when the user tweets & when the index (updates) happen. Is this layer MySQL or...

Unable to use regex to search in PHP?

Hi, I'm trying to get the code of a html document in specific tags. My method works for some tags, but not all, and it not work for the tag's content I want to get. Here is my code: <html> <head></head> <body> <?php $url = "http://sf.backpage.com/MusicInstruction/"; $data = file_get_contents($url); $pattern = "/<di...

Displaying sample text from the Lucene Search Results

Currently, I am using Lucene version 3.0.2 to create a search application that is similar to a dictionary. One of the objects that I want to display is a sort of "example", where Lucene would look for a word in a book and then the sentences where the words were used are displayed. I've been reading the Lucene in Action book and it menti...

What algorithms are out there for detecting lights and shadows and their parameters?

So I have picture (not the best one) I want to detect where the lights come from and what types of lights are they. What algorithm\framework can do such things with static images? I mentioned shadows because in general if you can separate a shadow from a surface than you can probably determine light type and other its parameters. I me...

Facebook "OR" queries with the graph API

Searching for "OR" queries on facebook is an exercise in futility as "OR" gets filtered. Cannot find a way to search for " X or Y or Z " https://graph.facebook.com/search?q=cats%20OR%20Dogs&amp;type=post Results in it only finding posts which contains both Cats and Dogs: { "id": "100000895865837_129212313793038", "from": { ...