@kevisual/project-search 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/app.js +13 -11
  2. package/dist/remote.js +13 -11
  3. package/package.json +1 -1
package/dist/app.js CHANGED
@@ -25142,23 +25142,25 @@ class ProjectSearch {
25142
25142
  async searchFiles(query = "", options) {
25143
25143
  const filter = [];
25144
25144
  if (options?.projectPath)
25145
- filter.push(`projectPath = "${options.projectPath}"`);
25145
+ filter.push(`projectPath starts_with "${options.projectPath}"`);
25146
25146
  if (options?.repo)
25147
25147
  filter.push(`repo = "${options.repo}"`);
25148
25148
  if (options?.filepath)
25149
- filter.push(`filepath = "${options.filepath}"`);
25149
+ filter.push(`filepath starts_with "${options.filepath}"`);
25150
+ if (options?.link)
25151
+ filter.push(`link = "${options.link}"`);
25152
+ const searchTerms = [];
25150
25153
  if (options?.title)
25151
- filter.push(`title = "${options.title}"`);
25154
+ searchTerms.push(options.title);
25155
+ if (options?.summary)
25156
+ searchTerms.push(options.summary);
25157
+ if (options?.description)
25158
+ searchTerms.push(options.description);
25152
25159
  if (options?.tags) {
25153
25160
  const tags = Array.isArray(options.tags) ? options.tags : [options.tags];
25154
- tags.forEach((tag) => filter.push(`tags = "${tag}"`));
25161
+ tags.forEach((tag) => searchTerms.push(tag));
25155
25162
  }
25156
- if (options?.summary)
25157
- filter.push(`summary = "${options.summary}"`);
25158
- if (options?.description)
25159
- filter.push(`description = "${options.description}"`);
25160
- if (options?.link)
25161
- filter.push(`link = "${options.link}"`);
25163
+ const fullQuery = [query, ...searchTerms].filter(Boolean).join(" ");
25162
25164
  const limit = options?.limit ?? 1000;
25163
25165
  const search = {
25164
25166
  filter: filter.length ? filter.join(" AND ") : undefined,
@@ -25169,7 +25171,7 @@ class ProjectSearch {
25169
25171
  let allHits = [];
25170
25172
  let offset = 0;
25171
25173
  while (true) {
25172
- const searchResults = await this.index.search(query, {
25174
+ const searchResults = await this.index.search(fullQuery, {
25173
25175
  ...search,
25174
25176
  limit: Math.min(limit - allHits.length, 1000),
25175
25177
  offset
package/dist/remote.js CHANGED
@@ -25142,23 +25142,25 @@ class ProjectSearch {
25142
25142
  async searchFiles(query = "", options) {
25143
25143
  const filter = [];
25144
25144
  if (options?.projectPath)
25145
- filter.push(`projectPath = "${options.projectPath}"`);
25145
+ filter.push(`projectPath starts_with "${options.projectPath}"`);
25146
25146
  if (options?.repo)
25147
25147
  filter.push(`repo = "${options.repo}"`);
25148
25148
  if (options?.filepath)
25149
- filter.push(`filepath = "${options.filepath}"`);
25149
+ filter.push(`filepath starts_with "${options.filepath}"`);
25150
+ if (options?.link)
25151
+ filter.push(`link = "${options.link}"`);
25152
+ const searchTerms = [];
25150
25153
  if (options?.title)
25151
- filter.push(`title = "${options.title}"`);
25154
+ searchTerms.push(options.title);
25155
+ if (options?.summary)
25156
+ searchTerms.push(options.summary);
25157
+ if (options?.description)
25158
+ searchTerms.push(options.description);
25152
25159
  if (options?.tags) {
25153
25160
  const tags = Array.isArray(options.tags) ? options.tags : [options.tags];
25154
- tags.forEach((tag) => filter.push(`tags = "${tag}"`));
25161
+ tags.forEach((tag) => searchTerms.push(tag));
25155
25162
  }
25156
- if (options?.summary)
25157
- filter.push(`summary = "${options.summary}"`);
25158
- if (options?.description)
25159
- filter.push(`description = "${options.description}"`);
25160
- if (options?.link)
25161
- filter.push(`link = "${options.link}"`);
25163
+ const fullQuery = [query, ...searchTerms].filter(Boolean).join(" ");
25162
25164
  const limit = options?.limit ?? 1000;
25163
25165
  const search = {
25164
25166
  filter: filter.length ? filter.join(" AND ") : undefined,
@@ -25169,7 +25171,7 @@ class ProjectSearch {
25169
25171
  let allHits = [];
25170
25172
  let offset = 0;
25171
25173
  while (true) {
25172
- const searchResults = await this.index.search(query, {
25174
+ const searchResults = await this.index.search(fullQuery, {
25173
25175
  ...search,
25174
25176
  limit: Math.min(limit - allHits.length, 1000),
25175
25177
  offset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/project-search",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {