# Stardog.js limit issue for search queries

**URL:** <https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397>\
**Category:** Bug\
**Created:** [November 20, 2018, 8:32pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397 "2018-11-20T20:32:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![potluri84](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/potluri84/32/326_2.png) [@potluri84](https://community.stardog.com/u/potluri84)\
**Post date:** [November 20, 2018, 8:32pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397/1 "2018-11-20T20:32:54Z")

</div>

Stardog.js limit and offset, when turned on are not giving the results for certain lucene searches. Same query when run in studio, i get results and when i remove the limit from javascript, i get results. Is this a bug?

SELECT DISTINCT ?matches ?subject ?property ?parent ?taxonomy ?preferredLabel WHERE {  
{SELECT ?matches ?preferredLabel  
?score ?parent ?subject ?property  
{ (?matches ?score) stardog:property:textMatch 'text\*' .  
?subject ?property ?matches.  
?subject rdf:type ?parent . }}  
?parent ont:coveredByConcept ?taxonomy .  
?taxonomy rdfs:prefLabel ?preferredLabel }  
group by ?matches ?subject ?property ?parent ?taxonomy ?preferredLabel

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [November 21, 2018, 3:13pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397/2 "2018-11-21T15:13:51Z")

</div>

My guess is that you are missing the `accept` parameter of `query.execute`. The method signature is actually `(conn, database, query, accept, params)`, though it's very easy to skip over accept and go straight to params.

If you set the limit via `query.execute(conn, 'myDb', myQuery, undefined, {limit: myLimit})` (passing undefined for accept), do you see results?

---

<div class="post-metadata">

**Author:** ![potluri84](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/potluri84/32/326_2.png) [@potluri84](https://community.stardog.com/u/potluri84)\
**Post date:** [November 21, 2018, 3:49pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397/3 "2018-11-21T15:49:52Z")

</div>

return query.execute(conn, dbName, sparql,  
'application/sparql-results+json', {  
limit: args.limit,  
offset: args.offset  
}  
).then(({ body }) =\> {

```
        return body.results.bindings;
          
        }).catch((err) => {
            return Promise.reject(err);
         });
    }
```

---

<div class="post-metadata">

**Author:** ![potluri84](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/potluri84/32/326_2.png) [@potluri84](https://community.stardog.com/u/potluri84)\
**Post date:** [November 21, 2018, 3:52pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397/4 "2018-11-21T15:52:01Z")

</div>

Query is const other than the search field.

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [November 26, 2018, 12:40pm UTC](https://community.stardog.com/t/stardog-js-limit-issue-for-search-queries/1397/5 "2018-11-26T12:40:28Z")

</div>

Would you be able to provide a minimal dataset for this query that can reproduce this issue?
