Skip to content

Commit

Permalink
Se incluye el API para eliminar documentos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonattan Velasquez committed Jul 13, 2023
1 parent 828e1c7 commit c882f7f
Show file tree
Hide file tree
Showing 30 changed files with 2,331 additions and 3,325 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
190 changes: 45 additions & 145 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,199 +1,99 @@
name: "Main action"

on:
push:
branches: [main]
pull_request:
branches: [main]
on: push

jobs:
install-linux:
name: "Install linux dependencies"
prepare:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 15.x, 16.x]

node-version: [18.x]
steps:
- name: Checkout repository 🛎
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} 🐲
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory path 📦
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: npm-cache
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.lock') }}
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install

- name: Install dependencies 📦
run: npm install

install-windows:
name: "Install windows dependencies"
runs-on: windows-latest

static-check:
timeout-minutes: 30
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 15.x, 16.x]

node-version: [18.x]
steps:
- name: Checkout repository 🛎
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} 🐲
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory path 📦
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: npm-cache
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.lock') }}
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run lint

- name: Install dependencies 📦
run: npm install

test-linux:
name: "Unit testing"
test:
timeout-minutes: 30

needs: install-linux
needs: static-check
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 15.x, 16.x]

node-version: [18.x]
steps:
- name: Checkout repository 🛎
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} 🐲
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory path 📦
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: npm-cache
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.lock') }}
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies 📦
run: npm install

- name: Unit Tests 🐞
run: npm test -- --coverage

- name: Coverage artifacts 🧳
uses: actions/upload-artifact@v2
- run: npm install
- run: npm test -- --coverage
- uses: actions/upload-artifact@v3
with:
name: coverage-report
retention-days: 1
path: |
coverage
test-windows:
name: "Unit testing"
timeout-minutes: 30

needs: install-windows
runs-on: windows-latest

strategy:
matrix:
node-version: [14.x, 15.x, 16.x]

steps:
- name: Checkout repository 🛎
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} 🐲
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory path 📦
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies 📦
run: npm install

- name: Unit Tests 🐞
run: npm test

report-coverage:
name: "Report coverage"
timeout-minutes: 30

needs: test-linux
needs: test
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

node-version: [18.x]
steps:
- name: Checkout repository 🛎
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} 🐲
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory path 📦
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: npm-cache
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.lock') }}
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Download a coverage artifacts 🧳
uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: coverage-report
path: coverage

- name: Coveralls 🔮
uses: coverallsapp/github-action@master
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
.github
node_modules
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"useTabs": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
}
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ npm install monolieta-search
## Usage

```js
import { Search } from "monolieta-search";
import { Search } from 'monolieta-search';

const client = new Search();
client.index("001", "The Lord of the Rings");
client.index("002", "The Hobbit");
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search("the hobbit"); // ["002", "001"]
client.search('the hobbit'); // ["002", "001"]
```

## Setting
Expand All @@ -42,73 +42,73 @@ client.search("the hobbit"); // ["002", "001"]

```js
const client = new Search({
caseSensitive: true,
caseSensitive: true
});

client.index("001", "The Lord of the Rings");
client.index("002", "The Hobbit");
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search("hobbit"); // []
client.search("Hobbit"); // ["002"]
client.search('hobbit'); // []
client.search('Hobbit'); // ["002"]
```

## Exact word strategy

```js
const client = new Search({
exactWordStrategy: true,
exactWordStrategy: true
});

client.index("001", "The Lord of the Rings");
client.index("002", "The Hobbit");
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search("o"); // []
client.search("Rings"); // ["001"]
client.search('o'); // []
client.search('Rings'); // ["001"]
```

## Ignore accent

```js
const client = new Search({
ignoreAccent: false,
ignoreAccent: false
});

client.index("001", "Parásitos");
client.index("002", "Déjame salir");
client.index("003", "El Tiburón");
client.index('001', 'Parásitos');
client.index('002', 'Déjame salir');
client.index('003', 'El Tiburón');

client.search("Tiburon"); // []
client.search("Tiburón"); // ["003"]
client.search('Tiburon'); // []
client.search('Tiburón'); // ["003"]
```

## Stop word

```js
const client = new Search({
stopWord: {
the: true,
},
the: true
}
});

client.index("001", "The Lord of the Rings");
client.index("002", "The Hobbit");
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search("the"); // []
client.search("the hobbit"); // ["002"]
client.search('the'); // []
client.search('the hobbit'); // ["002"]
```

## Unordered document

```js
const client = new Search({
unorderedDocument: false,
unorderedDocument: false
});

client.index("001", "The Lord of the Rings");
client.index("002", "The Hobbit");
client.index('001', 'The Lord of the Rings');
client.index('002', 'The Hobbit');

client.search("the"); // ["001", "002"]
client.search("the hobbit"); // ["002", "001"]
client.search('the'); // ["001", "002"]
client.search('the hobbit'); // ["002", "001"]
```

## License
Expand Down
Loading

0 comments on commit c882f7f

Please sign in to comment.