How to setup Solr search across REST urls - search

We are implementing an API Portal and have a field named basePath to hold the base part of the api's rest url. Currently the field is defined as a string mapped to solr.StrField but we have search problems with this.
The problem right now is that in order to find an API by the basePath, we need double quote the value in the search. For example name:"/v1/api-proxy/generator" We cannot use name:/v1/api-proxy/* to see other apis that might have clashing urls. We know we have other urls like '/v1/api-proxy/validator' but something like name:/v1/api-proxy/* doesn't return any hits.
I am guessing a first step is to change away from 'string' to text or text_general, but how can search and find other hits that closely match the provided basePath?

Related

How do you construct an Azure Search query to return a wildcard search based solely on a specific field?

If I may have missed this in some other area of SO please redirect me but I don't think this is a duped question.
I am using Azure Search with an index field called Title which is searchable and filterable using a Standard Lucerne Analyzer.
When using the built-in explorer, if I want to return all Job Titles that are explicitly named Full Stack Developer I can achieve it this way:
$filter=Title eq 'Full Stack Developer'&$count=true
But if I want to retrieve all the Job Titles using a wildcard to return all records having Full Stack in the name this way:
$filter=Title eq 'Full Stack*'&$count=true
The first 20 or so records returned are spot on, but after that point I get a mix of records that have absolutely nothing in common with the Title I specified in the query. My initial assumption was that perhaps Azure was including my specified Title performing an inclusive keyword search on the text as well.
Though I found a few instances where that hypothesis seemed to prove out, so many more of the records returned invalidated that altogether.
Maybe I don't understand fully the mechanics under the hood of Azure Search and so though my query appears to be valid; my expectation of the result is way off.
So how should my query look to perform a wildcard resulting to guarantee the words specified in the search to be included in the Titles returned, if this should be possible? And what would be the correct syntax to condition the return to accommodate for OR operators to be inclusive?
Azure Cognitive Search allows you to perform wildcard searches limited to specific fields only. To do so, you will need to specify the name of the fields in which you want to perform the search in searchFields parameter.
Your search URL in this case would be something like:
https://accountname.search.windows.net/indexes/indexname/docs?api-version=2020-06-30&searchFields=Title&search=Full Stack*
From the link here:

getting correct names for Dbpedia sparqlwrapper queries

I am querying DBpedia for information about organizations and I am using "dbpedia.org/page/[organization]" to find what name is used for those organizations. It will usually fix the inputted name to the name it uses. eg dbpedia.org/page/Tmobile will be redirected to T-Mobile.
When making a query using SPARQLwrapper to 'http://dbpedia.org/sparql' these names usually work but not always (such as the previous T-Mobile example. How can I find the specific name to use when querying DBpedia using SPARQLwrapper?
My first thought is that you're using the wrong URIs for your SPARQL queries -- .../page/... are HTML representations of the descriptions of the entities. .../resource/... are the identifiers of the entities (which get redirected to the .../page/... when you use a web browser, which requests HTML, to dereference the .../resource/... URIs).
In other words, instead of, for instance (results here) --
DESCRIBE <http://dbpedia.org/page/Tmobile>
-- try (results here) --
DESCRIBE <http://dbpedia.org/resource/Tmobile>

Kentico 12 Azure Search

I'm trying to implement Azure Search on Kentico 12. Following the article below.
https://docs.kentico.com/k12/configuring-kentico/setting-up-search-on-your-website/using-azure-search/integrating-azure-search-into-pages
However, I have multiple indexes defined on the smart search not just a single index code name that I can hard code and also cannot aford to hard code index fields. Is there any tutorial out there that I can follow?
It sounds as if you're referring to building an Azure Search web part, is this correct. If so, make a property in your web part which allows you to select the code name from a list in the database. Secondly, regarding field names, you should be using generic field names like DocumentName, NodeAliaspath, etc. Although if you have very specific search results that need to be displayed, simply put in a switch statement to get the field names based on a class name.

Extending Orchard Search and Indexing

We need to provide search options for users to find content based on specific field values.
We're developing a Training Course module for a client but the standard search looks for the text in any indexed field. We want to allow users to find courses based on searches against specific fields (i.e. Course Type, Location, Price, Date).
We've extended the search to check against specific fields but can't work out how to get the URL parameters passed by the Search form as a GET.
Where does Orchard put URL parameters?
Also, are we missing something, is there a way that Orchard already supports this that we haven't realized?
I would suggest you to copy part of the Search module, more specifically the Controller and the View and then modify it to suit your specific needs. I see you are actually modifying the original module, but this might be a problem on the long term, for instance if we start updating the module you might either lose you changes or have to reapply them to the code base. In the end you will target a MySiteName.Search module. And you can also add custom routes, custom settings.
On a side note the Search API is really powerful and you can even use it to do faceted search, or search on inherited taxonomy terms, tags, full text, ranges, ... Having your own controller code will let you use all of these features easily.

How to design a RESTful URL for search with optional parameters?

If I have to create a URL in my RESTful web service, which would be used by my clients to search all businesses by their fields where the fields are optional, what would the URL look like?
A business can be search by their name alone, name and phone number or name, phone number and contact e-mail.
Chandru,
think of the list of all the businesses like of a set of entities with attributes. You can create URIs that identify (select) a subset by the use of parameters in the URI.
Commonly this is done by query string parameters (the stuff after the '?') but you can also specify parameters as path segments or matrix URIs.
The most typical means to do this would be something like
http://foo.org/service/businesses/?name=acme or
http://foo.org/service/businesses/?name=acme&phone=12345 or
http://foo.org/service/businesses/?name=acme&contact=smith#bar.org
('#' would need URL encoding of
course)
It is conceptually similar to an SQL select clause.
Parameters in path segments or matrix parameters have an impact regarding the indexing possibilities (e.g. matrix parameters allow you to filter at multiple levels because the hierarchy can continue after wards, which it cannot with query parameters). I suggest you make that a different question if you are concerned with it.
Example:
http://foo.org/service/businesses/france/name=acme;city=paris/latest/?contact=xxx
Jan

Resources