How to create search engine in leaflet map using apache solr? - solr

I'm building an app that lets user find vacation rental from map. I've several data in my leaflet application. So my question is about:
How to make a search engine from the map itself that search the marker id(and content of it)?
In this case, i wish to create a search bar outside the map which user can search any places and the result should be appear in the map in the form of marker pointer which indicate the result instead of list of result in list view.
How to make the marker appear when user query the result

Your use case have a solution In Kibana-6 with elasticsearch , there is a lucene bar search which search interactively your data.
this is my work on nyc-cabs-data :
as you can see in the lucene bar i search the field total_amount which is a column in my csv

Related

How to remove highlights tags before in Azure Cognitive Search documents before searching

Azure Search by default highlights search results with <em> tag. I've met with situation where user uploads document with that tag inside:
<em>Today</em> topic will be...
When i would search for "topic" i would get:
<em>Today</em> <em>topic</em> will be...
And i wouldn't be able to distinguish the right highlight.
I know that i can modify highlight_pre_tag and highlight_post_tag so i would avoid this in this particular situation. But is there other way to encode this tags before appyling highlighs?
EDIT:
By encoding i mean getting something like this:
<em>Today</em> <em>topic</em> will be...;
So I can send it to frontend and then display <em> from "Today" as <em> and use <em> in "topic" to highlight it to yellow.
Azure Search doesn't provide any built-in mechanism to modify the "raw" content of a document if you are using the Index API directly, however, if you are using one of our built-in indexers, you can look into using the field mapper functions (such as the UrlEncode function) or create your own custom skill (if you want to only apply very specific rules) to transform the documents in transit from your data source to the search index.
Alternatively, we've seen customers use custom highlight pre and post tags that are easily recognizable (and unlikely to be mistaken for original content) and then using a simple search and replace function in their client application to transform those back into the desired tag.
For example, using
pre-tag : "!HIGHLIGHT_START!" and post-tag :"!HIGHLIGHT_END!"
and then using
String.Replace("!HIGHLIGHT_START!", "<em>")
before displaying the results in their application. That way, any client-side logic that requires finding the actual highlights can use the custom tags, while still showing the desired tag in the UX.

integrating road signs in Here maps

Hi I am new to React and Here maps, I am using Here maps for maps. Currently I am able to show live marker position, I want to show road signs as well.
For that I am constructing a request as specified here documentation
https://image.maps.ls.hereapi.com/mia/1.6/roadsign?apiKey=H6XyiCT0w1t9GgTjqhRXxDMrVj9h78ya3NuxlwM7XUs&region=USA&category=0&label=I-80&w=100&h=100&f=0
In the documentation , only highways signs are mentioned. Is it possible to query traffic,speed limit signs as well? And the response returns image(PNG) , I am thinking to put that image onto map at specific lat and long position. Is this the right way to do?
The roadsign feature of the Map Image API has a very limited selection of signs and is in maintenance. You will have to create or source these images yourself. Fortunately there are many free icon collections available on the web.
Once you have the images, you can use a MapMarker to place these on the map.

Search Highlights in file Contents

We have .net application displaying data from using Azure Search service, based on DotNet search App Template
Is there a possibility to show only parts of the file with the highlighted term - for example PDF file page with term highlighted on top?
Have you looked up using the highlight feature?
https://learn.microsoft.com/en-us/rest/api/searchservice/search-documents#highlightstring-optional
Your search results will then have a new #search.highlights field which contains a collection of passages with the searched terms. Then you can also use the $select parameter to decide which fields to retrieve and which one to ignore.
https://learn.microsoft.com/en-us/rest/api/searchservice/search-documents#selectstring-optional

Using google search api cursor in angular js app to get all results for google patent search

I want to make a search into google patent using the following URL which is obsolete
https://ajax.googleapis.com/ajax/services/search/patent?v=1.0&q=thumb%20wrestling%20apparatus&userip=192.168.1.102
It gives me limited number of records per page.
But at the end of the JSON it also returns the cursor which has start and label keys. So my question is that how can I use that cursor to show all the records in my search. Like if there are 8 pages and each page contains 4 records so I want to show all 32 records on my UI.
How can I achieve that?
And second question that is there REST APi for google patent search? If yes then how can I search the patent using REST API and how can I get all the records on one page?
It looks like the API is restricted to a maximum of 8 results per request (you can increase your current 4 results to 8 by using the query param rsz=8.
So I guess the only way to get all results is by performing multiple requests. So if the current page info data is...
"pages":[
{"start":"0","label":1},
{"start":"8","label":2},
{"start":"16","label":3},
{"start":"24","label":4},
{"start":"32","label":5}
]
You would make 5 requests chaining the start param start=0, start=8 ... and so on, extracting the results and pushing to an array store. If you're not already I recommend using something like Restangular, as it would make this process much easier.
Depending on how your UI is set out, it would be nice maybe to do this with some lazy loading as the user is scrolling through the list?

Solr autocomplete keyword and geolocation based

I am looking for getting auto complete suggestions using Solr based on keyword as well as geolocation. Is there a way the 'Suggester' component or any other way, Solr can take in multiple fields for auto completion?
For e.g. if I have a restaurants database and I want to get suggestions using keyword e.g. 'Piz', the results should be based both on the keyword 'Piz' and also the locations that are close to certain latitude, longitude.
Is there a way to do it in Solr ?
Thanks.
you create a handler that:
in the index analyzer chaing, use EdgeNGram to math what the user entered so far
boost results with geodist(): play around with recip() etc until you get desired weight on the location boosting
call that handler and pass current location and user entered chars and you are done

Resources