Grails Searchable Plugin - Filtering Result Set - grails

I am currently using Lucene. My requirement is like facebook search box. User search people and friends. But in my requirement user have privacy settings like name, location, email address are visible to everyone or only friends. He can show and hide these fields from friends and other members of the community.
I have implemented simple search on the basis of name, location and email address. But now i am modifying search on the basis of privacy settings.
Here is my scenario..
User A has privacy settings:
Name is only shown to friends
Email is shown to every one
Location is not shown to any one.
If User X type location of the User A in the search box then it should not be in the results. But if User X type Name of User A in the search box then it should be shown because User A has not restricted name and it is visible to his friends in the privacy settings.
Can you please guide me to the approach.
Let me know if i have not clearly write my requirement.
I have analysed following approaches,
1- IndexSearcher's explain method (It will be hit overall performance)
2- Explored Filters
But couldn't get much
My Approach:
Get the resultSet on the basis of name
Get the resultSet on the basis of location
Get the resultSet on the basisi of email address
Loop on each 3 result set and apply conditions related to privacy settings and exclude the items on the basis of privacy settings. And in the end merge all 3 results set.
If there is any other approach? Please share with me. Thanks.

may be you can use lucene query syntax in searchable plugin for creating lucene Query according to requirement.
you can find here or here
you can restrict seaching by overriding default property settings. You just need to apply like this....
class A {
String x
String y
String z
static searchable = [only: ['x', 'y']]
// …
}
Using this you can restrict searchable properties.

Related

How to search users in Microsoft Graph SDK with C#?

In my C# application, I am using Microsoft Graph SDK with Azure AD implementation.
Please suggest me how to search users in my organisations (global contacts) based on search parameters .
For example , if "Raj" is the search parameter, I should be able to get all users with their name contains "Raj" or email address contains "Raj".
I found this method to get all users - "graphClient.Users.Request().GetAsync();". but, with this method limited response, I am not getting what exactly I want to search.
Thanks,
Shashidhar
Adding to the previous answer: to accomplish this through the Graph C# SDK, use the Filter() method:
graphClient.Users.Request().Filter("startsWith(displayName, 'k')").GetAsync()
You can use other methods on the request to customize the request, e.g. Select(), etc.
According to your description, I assume you want to search the users by using the search parameters.
Based on this document, we can currently search only message and person collections.
And I have tried the filter query parameter, the parameter is currently not supported the contains operator from this document. So if you want to search the user with name or the email address, we can use the startswith operator only.Like this:
https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'k') or startswith(mail,'k')
It will find the user's diplayName or mail which is start with the k

Does Google AdWords support automatically appending a different query string to a campaign's destination URLs for ads and sitelinks?

I have an existing Google ad campaign that geotargets a particular region. The destination URL of all the ads and sitelinks have the same query string appended to it ("area=astoria").
I now need to copy this campaign to 50 other campaigns, each of which will target a different region. Each campaign will have a different value for the area key, so for instance one campaign might use "area=manhattan" and another "area=bronx".
The campaign I'm cloning has many ads and sitelinks, all of which need to have the query string changed. I know how to manually change the destination urls, but it's an enormous amount of busy work...
As a workaround, is there a way to automatically append a different query string to all the destination URLs for ads and sitelinks in a particular campaign in Google AdWords?
To answer my own question, the answer is to use a Tracking Template on the Campaign level.
To do this, click into the Campaign you want to edit and click on the Settings tab. Then open the "Campaign URL options (advanced)" section and change the Tracking URL to something like this:
{lpurl}?area=whatever
You can click the TEST button to make sure your ads work. Your sitelinks should also have the same query string appended to it. (Note that a Campaign-level Tracking Template can be overridden at the Adgroup-, Ad-, or Sitelink-level, so those more specific Tracking Templates would have to not be used for a Campaign-level Tracking Template to be used.)

Algolia search with attribute name

Data on algolia is like this
objectID:3464542
Type:"Accelerator"
Country:"Germany"
City:null
Name:"ProsiebenSat1 Accelerator Batch #8"
I want to search any name which are in Germany. How I do that?
When I do Contact.raw_search("Batch"), I get all records even whose name include this even non-German. I want to get all those which are of specific country.
To do so, you'll first need to put the Country attribute in your attributesForFaceting list. You can do that using the REST API, your client of choice or from the Algolia Dashboard. Using the later one, go to the Indices page, select your index and click on the Display tab. Here, you could add your Country field to the Attributes for faceting list. After that, click on save and your index will be rebuild.
Now, your index is ready to filter the search queries according to the country you want. To perform the search query, you can use (using the Ruby client):
Contact.search("Batch", {
facets: ["Country"],
facetFilters: ["Country:Germany"]
})
For more informations about faceting, here is a quick intro from the FAQ and a more detailed guide in the documentation.

Searching other fields in the internal backoffice search box - v7.1.0

My aim is to add additional fields to the searching parameters for the internal search - I have amended ExamineIndex.config to index the new property:
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
<IndexUserFields>
<add Name="briefing"/>
</IndexUserFields>
</IndexSet>
However, after rebuilding the internal index, it seems as though the internal search is only using the node name.
Is it possible to search multiple properties with the internal search?
You are quite right - the Content and Media searches only take into account the Node Name, along with a path restriction if the current user has a starting node specified.
Member search also includes the following additional fields:
email
loginName
As a reference, see the implementation here:
https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Editors/EntityController.cs#L227-L283
If you want to implement a custom search, you'd have to create a plugin or dashboard that would allow you to implement the search features you want.
For some ideas, checkout the MemberListView project (which uses custom examine searching to populate the list): https://github.com/robertjf/umbMemberListView

Address suggestions while searching offline SKMAPS

I am using MultiStep offline search in SKMaps. I have a search bar in my application, where a user can type an address to search in an offline downloaded package say California. While writing an address in the search bar , I want to show address suggestions to user. Is this possible with Skobbler? I could not find any api provided.
In the current APi there is not "one line search" (type the whole address in a single line) and no out-of-the-box typeahead.
You can implement the typeahead by using the user's input as a search term for the multiline search - http://developer.skobbler.com/getting-started/ios#sec20 - you will have to decide if that term is a city or a street in a particular city for this to properly work.
On another note - we are working on a new geocoding implementation that would provide one line search and typeahead - this should be out in Q1 or Q2 2015

Resources