Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dist/apisearch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/apisearch.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/apisearch.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/apisearch.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/Repository/HttpRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ var HttpRepository = /** @class */ (function (_super) {
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.httpClient.get("/" + this.appId + "/indices/" + this.indexId, "get", this.getCredentials(), {
query: JSON.stringify(query.toArray())
.replace(/&/g, "%26")
}, {})];
case 1:
response = _a.sent();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apisearch",
"version": "0.3.7",
"version": "0.3.8",
"description": "Javascript client for Apisearch.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/Repository/HttpRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export class HttpRepository extends Repository {
"get",
this.getCredentials(),
{
query: JSON.stringify(query.toArray()),
query: JSON.stringify(query.toArray())
.replace(/&/g, "%26"),
},
{},
);
Expand Down
16 changes: 16 additions & 0 deletions test/Functional/Apisearch/Query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,22 @@ describe('Queries without cache', () => {
expect(result.getFirstItem().getUUID().getId()).to.be.equal("1");
});
});

it('should be able to work with ampersands in query', async() => {

repository.addItem(Item.create(
ItemUUID.createByComposedUUID('1~item'), {}, {},
{'name': 'Hit & Run'},
));

await repository.flush();

await repository
.query(Query.create("Hit & Run"))
.then(result => {
expect(result.getTotalHits()).to.be.equal(1);
});
});
});

/**
Expand Down