is it possible to add pagination in ldap get all members query? - node.js

I am getting all memebers from AD group with the query
(&(objectClass=user)
(memberof:1.2.840.113556.1.4.1941:=CN=GroupOne,OU=Security Groups,OU=Groups,DC=YOURDOMAIN,DC=NET)
But it is just giving first 1000 users in that group because of default pagination.How to get next set of 1000 users results? is it possible to
add pagination in same query?
I am using ldapjs with node.js as a client.Please give some example query with pagination.

The documentation for LDAPJS talks about this: http://ldapjs.org/client.html#paging
Basically, use the the paged property when searching. You may have to set the sizeLimit to 1000 (or less) too.

Related

How to do pagination in NeptuneDB to achieve high performance

Hi I am now building a website using aws NeptuneDB(Gremlin), NodeJs as Backend and Angular as Frontend. Now I am facing a problem, I want to do pagination on my website because without pagination I may load and display 5000 items one query. I know in MySQL, we can using like
select * from mydb limit 0, 20;
to do pagination.
Can I achieve similar in NeptuneDB(or GraphDB). I investigated for a while and I found this:
How to perform pagination in Gremlin
Refer to the answer of this question, It seems we cannot avoid loading all query results into memory. Does it mean it doesn't make any difference with or without the pagination.
Or can I achieve pagination between Node and Angular(I am just guessing)?
So Any ideas to improve performance?
It seems I can use like
g.V('vertice').out('some_relationship').order().by().range(0,3)
The order can be guarantee through order()
But the problem is:
In pagination, we need to get three parameters: currentPage, PageSize, TotalNumOfItems', currentPage and PageSize is pass from frontend, but how can we get the total number before retrieving items?
my way is just count before retrieve items:
g.V('vertice').out('some_relationship').count()
g.V('vertice').out('some_relationship').order().by().range(0,3)
Will this work?

How to resolve relationship using Composer Query?

My assets:
Vehicle which contains an owner.
I want to list all vehicles along with its owner information using Query in queries.qry.
Using AssetRegistry I can get the results using resolveAll method, anyway how to get the same result using Query?
resolveAll isn't available in the Composer runtime at the time of writing (ie like it is in composer-client) so you can't get all resolved relationships invoking a Query (say in a TP) - see Issue
https://github.com/hyperledger/composer/issues/3454 . But you can get them via REST Filters ; adding {"include":"resolve"} as a filter, will resolve all the relationships to the asset owners and you can process the results that way.

Algolia Key Value Search

I am currently working with the Algolia search API and I am unable to figure out how I would limit the results by key value searching + query string. By this i mean this.
I have a list of properties.
Each property belongs to a client.
Within the application If i am looking at a client information card and I want to search for a property that client owns It would make more sense to limit the results to the client and then look for the query string.
I am using MongoDB as my DB and storing the client id as a sub document like so
//Property Document
{
_id : "randomID"
client : {
_id : "randomID",
name : "ClientName"
}
}
If you want to restrict the search to a specific client, I would go for facet filtering to restrict the search to that client only.
Add client._id in the attributesForFaceting in your index settings
Filter your searches with the facetFilters=client._id:MYCLIENTID query parameter
Then, you should also take a look at the Secured API keys which are able to encode such restriction in a secure way (so the end-user cannot patch the JS code and work-around the filtering).
There is parameter called restrictSearchableAttributes[link] to restrict, at query time, search to some attributes only. Nevertheless, in your case I think you'd get more accurate results by putting each client info into a different record (+ the info of the related document).

Honoring previous searches in the next search result in solr

I am using solr for searching. I wants to improve my search result quality based on previously searched terms. Suppose, I have two products in my index with names 'Jewelry Crystal'(say it belongs to Group 1) & 'Compound Crystal'(say it belongs to Group 2). Now, if we query for 'Crystal', then both the products will come.
Let say, if I had previously searched for 'Jewelry Ornament', then I searches for 'Crystal', then I expects that only one result ('Jewelry Crystal') should come. There is no point of showing 'Compound Crystal' product to any person looking for jewelry type product.
Is there any way in SOLR to honour this kind of behavior or is there any other method to achieve this.
First of all, there's nothing built-in in Solr to achive this. What you need for this is some kind of user session, which is not supported by Solr, or a client side storage like a cookie or something for the preceding query.
But to achive the upvote you can use a runtime Boost Query.
Assuming you're using the edismax QueryParser, you can add the following to your Solr query:
q=Crystal&boost=bq:(Jewelry Ornament)
See http://wiki.apache.org/solr/ExtendedDisMax#bq_.28Boost_Query.29

How can I configure Sitecore search to retrieve custom values from the search index

I am using the AdvancedDatabaseCrawler as a base for my search page. I have configured it so that I can search for what I want and it is very fast. The problem is that as soon as you want to do anything with the search results that requires accessing field values the performance goes through the roof.
The main search results part is fine as even if there are 1000 results returned from the search I am only showing 10 or 20 results per page which means I only have to retrieve 10 or 20 items. However in the sidebar I am listing out various filtering options with the number or results associated with each filtering option (eBay style). In order to retrieve these filter options I perform a relationship search based on the search results. Since the search results only contain SkinnyItems it has to call GetItem() on every single result to get the actual item in order to get the value that I'm filtering by. In other words it will call Database.GetItem(id) 1000 times! Obviously that is not terribly efficient.
Am I missing something here? Is there any way to configure Sitecore search to retrieve custom values from the search index? If I can search for the values in the index why can't I also retrieve them? If I can't, how else can I process the results without getting each individual item from the database?
Here is an idea of the functionality that I’m after: http://cameras.shop.ebay.com.au/Digital-Cameras-/31388/i.html
Klaus answered on SDN: use facetting with Apache Solr or similar.
http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=35618
I've currently resolved this by defining dynamic fields for every field that I will need to filter by or return in the search result collection. That way I can achieve the facetted searching that is required without needing to grab field values from the database. I'm assuming that by adding the dynamic fields we are taking a performance hit when rebuilding the index. But I can live with that.
In the future we'll probably look at utilizing a product like Apache Solr.

Resources