Solr spatial search on multivalued location field - search

Is there a way in Solr to know the matching address within a document on a mutlivalued location field and not just the document. For example, i might have "Store A" with locations "100 Main Street, NY, 00001" and "100 NotMainStreet, NY, 00010" which are 40 miles apart. When I search for "00002" assuming "100 Main Street, NY, 00001" matches, I want result to somehow indicate location "100 Main Street, NY" of "Store A" matches.
I tried Solr2155 patch for Solr3.5 but I could not find anything in there that can achieve this, I checked out documentation of new Solr4 Spatial Search module but I dint find anything useful there as well. Please help, thank you

Related

Azure search relevance

Need help, I have an azure index called customer and have two fields in it customers & contacts, I have applied boost function for both the fields with boost 100 & 90, the problem is when I search any text it returns customer related relevance first and then contacts relevance.
Eg: If I search for "Johnson"
It will return all the customer details with Johnson first and then contact details even if the contact name matches "Johnson"
List of records displayed.
Record 1: This is customer
Johnson & tyson
Segment: Enterprise | Vertical: Healthcare | Country: US
Record 2: This is contact however it is associated with customer "Johnson and tyson"
Michael Walton
Customer:Johnson and tyson | Segment: Enterprise | Vertical: Pharmaceutical
Record 3: This is contact however it is associated with customer "Johnson and tyson"
Henri Vliegen
Customer:Johnson and tyson | Segment: Ent | Vertical: Pharmaceutical
Record 4: This is contact it is associated with customer "WST"
Henri Johnson
Customer:WST | Segment: Enterprise | Vertical: Pharmaceutical
So in this way records are displayed its most probably on scoring however I want the relevance name
to be displayed first like record 4 is contact and it should have been in place of record 2 since Johnson is the last name
I believe that it's because you're boosting with the same values, so it's like this:
if(Customer.Contains("Johnson") || (Contact.Contais("Johnson"))
{
//display
}
//PS: this statement is just to clarify that Contact and Customer name have the same importance.
Try to boost with different values, and I believe it will work. (100 for Customer and 90 for Details).
UPDATE
It seems that you are indexing first and last name separately. If you have a field "fullname" and boost through it, probably you'll get the expected result. Another option is create a scoring profile using those fields:
https://azure.microsoft.com/en-us/documentation/articles/search-get-started-scoring-profiles/
I read the question several times. While the question mentions that you have one index, the records displayed imply that you actually have two search indexes. Is this correct? I've been working on a training course for Azure Search, which discusses indexes and scoring in-depth.
At this time, Azure Search does not support cross-index queries. For that reason, if my understanding of your problem is correct, you'd have to run two queries: The first on the Customer index and the second on the Contacts index. Part of the reason that Azure Search is able to execute searches so quickly is because its a flattened out data structure, which allows for fast look-ups and queries. However, you're scenario implies something relational.
Am I misunderstanding your question?

Azure Search suggestions based on multiple terms

I have an online grocery store, products have such attributes:
product name (Pepsi, 7UP)
container (1 bottle, 1 can)
variant name (diet, max)
I want my Azure Search solution to suggest users required product regardless of search terms order (diet Pepsi, 1 can Pepsi, Pepsi 1 can), but with no luck.
I wonder, if the only way to do this is to compute a "keywords cloud" which will contain all possible permutations and use this "keywords cloud" field as a suggester field? Example of such "keywords cloud" field value: "Pepsi diet 1 can diet Pepsi 1 can Pepsi".
Azure Search search solution somehow does the trick, but I can't use it because it doesn't support typeahead (AFAIK).
Any insight will be appreciated.
Suggestions are built for cases where you want to progressively discover a short phrase. In your case it looks like what you want is to search for any word across the documents, in any order. For that you could simply issue a search request instead of a suggest request in each keystroke. That will execute a keyword search, which seems like it's what you're looking for.
If you want the last word to be treated as partial input, you could do the following trick assuming you target languages that separate words with whitespace: take the input text, split out the last word (i.e. go backwards from the end of the string until you find a non-character/number symbol) and then produce a string of the form "original-minus-last (last|last*)". For example, if the input is "Can Pepsi Di", you'd produce "Can Pepsi (Di|Di*)".

City proximity search drupal

I need to implement a proximity search in Romania for articles based on the city name that has been inserted in a form field in a Drupal project. After browsing a lot of articles I see there are a lot of suggestions and solutions for zip codes and streets , but I only need the city geocodes ( lets say the center of that city ).
Where can I find such a database to insert into my project? Or is there another solution for this problem?
I would use the Geofield module to store the coordinates and then the Geocoder module to populate the geofield from the city field that you already have.
With Geocoder you can choose which service you want to use Google Geocoder, Yahoo, Bing etc
You can the use Gmap module or Open layers and Views to display your results.

Can you smart-search on Google, keywords within URL's instead of body text

I was wondering if one could smart search with Google, looking for URL's containing your keywords, instead of searching for websites containing your keywords, on the page themselves.
Use the inurl:, intext:, inanchor:, and intitle: search filters, e.g., by using one these queries in the search box
Pages with Obama in the URL; the phrase, climate change, in the title; & talk about solar power or education
inurl:obama intitle:"climate change" intext:("solar power" education)
Pages containing Obama in the URL and not Michelle, that talk about the State of the Union address
inurl:obama -inurl:michelle ("SOTU" | "state of the union")
Government sites using WordPress
inurl:wp-content site:.gov
The allinurl:, allintext:, allinanchor:, and allintitle: search filters also exist & supersede other filters, e.g.,
allintitle:barack michelle obama
is equivalent to:
intitle:barack intitle:michelle intitle:obama
or more simply:
intitle:(barack michelle obama)
however you can't search for:
allintitle:barack michelle obama -inurl:-divorce intext:"climate change"
wherease you can search for:
intitle:(barack michelle obama) -inurl:-divorce intext:"climate change" 2008..2016
If I understand you correctly, yes. Googles advanced search (http://www.google.ca/advanced_search) will allow you to search the URL. In the terms appearing: drop down select in the URL of the Page and it should do what you want.

magento search issue

I have one issue which I am in desperate need for your help. I am on Magento ver. 1.6.1.0, whenever I am searching with a sentence like "baby's cute shoes" in magento then the results are not accurate but when I search only a word like "cute" or "shoes" then it gives me the result.
I have a feeling that magento is not able to search a sentence but it is able to search products with words. Is there anything I can do to better optimize the search in magento?
The options for search can be found in the backend under System > Catalog > Catalog search, you probably have search type set to LIKE. You will potentially get better results using FULLTEXT mode.
Magento does not search the entered string as a full sentence. Instead it splits (tokenizes) your search string into words and will search for products containing ANY of these words (implementing "OR" logic). So if you are searching for "red shoes", it will find everything containing words "red" OR containing words "shoes". Obviously it is not very useful in most cases as it will produce a lot of totally irrelevant results.
You can check this free extension to refine your search: Catalog Search Refinement FREE. This extension modifies the search behavior to only find the products that have ALL keywords ("AND" logic in other words). This will find only products that have both "red" and "shoes" keywords. There is also Advanced Search version of that extension that also looks up for similar words based on phonetic distance among other things as well as weighted search attributes, allowing to bubble up the most relevant products.
I got my issue resolved by this link - https://stackoverflow.com/questions/1953715/magento-search-not-returning-expected-results
I went to this line in app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
and did this (below)
copy app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php to app/code/local/Mage/CatalogSearch/Model/Mysql4/Fulltext.php
line 341 - 343 app/code/local/Mage/CatalogSearch/Model/Mysql4/Fulltext.php
if ($like) {
$likeCond = '(' . join(' OR ', $like) . ')';
}
change into
if ($like) {
$likeCond = '(' . join(' AND ', $like) . ')';
}
Also make sure to change the order in which the results are shown. Default Magento is to serve it backwards.
Add the following to /app/design/frontend/default/default/layout/catalogsearch.xml
<reference name="search_result_list">
<action method="setDefaultDirection"><string>asc</string></action>
<action method="setDefaultOrder"><string>relevance</string></action>
</reference>
Between the following:
<catalogsearch_result_index translate="label">
...
</catalogsearch_result_index>
Stock Magento search needs a few tweaks to get it functional. The Like search was changed from AND logic to OR logic in 1.5/1.6 and gives better results when reverted back to AND logic. This has been solved in several threads over in the Magento forums on Magento's website. Another fix is to to chop the s off of plurals which is also addressed over there.
The reason for cutting trailin "s" is that most people don't search for "an oil pressure gauge", but "oil pressure gauges" which gives total misses when you're selling a "0-100 psi Oil Pressure Gauge". Also alias all items ending in "ies" to their singular. Rarely do you sell an "rc aircraft batteries", it will be specific like "1200aH aircraft battery" and so your less savvy customer's searches never match.
"Baby's cute shoes" will never register a hit unless it shows up in the items you use to populate the Fulltext search index. Who sells an item called "baby's cute shoes" anyway? I usually synonym these types of searches to hit a specific category where the items are listed. Some customer searches are just too subjective to match the objective nature of product search (actual items vs. nebulous idea).

Resources