Skip to content

feat: fix search and index type for search and indexing #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videodb",
"version": "0.1.3-beta",
"version": "0.1.3",
"description": "A NodeJS wrapper for VideoDB's API written in TypeScript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export enum SearchTypeValues {
}

export enum IndexTypeValues {
spoken = 'spoken',
spoken_word = 'spoken_word',
scene = 'scene',
}

export const DefaultSearchType = SearchTypeValues.semantic;
export const DefaultIndexType = IndexTypeValues.spoken;
export const DefaultIndexType = IndexTypeValues.spoken_word;

export const SceneExtractionType = {
shotBased: 'shot',
Expand Down
6 changes: 4 additions & 2 deletions src/core/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class SemanticSearch
data: SemanticVideoSearch | SemanticCollectionSearch
) => {
return {
index_type: SearchTypeValues.semantic,
search_type: SearchTypeValues.semantic,
index_type: data.indexType,
query: data.query,
score_threshold:
data.scoreThreshold ?? SemanticSearchDefaultValues.scoreThreshold,
Expand Down Expand Up @@ -106,7 +107,8 @@ class KeywordSearch
data: KeywordVideoSearch | KeywordCollectionSearch
) => {
return {
index_type: SearchTypeValues.keyword,
search_type: SearchTypeValues.keyword,
index_type: data.indexType,
query: data.query,
score_threshold:
data.scoreThreshold ?? KeywordSearchDefaultValues.scoreThreshold,
Expand Down
2 changes: 1 addition & 1 deletion src/core/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class Video implements IVideo {
const indexJob = new IndexJob(
this.#vhttp,
this.meta.id,
IndexTypeValues.spoken
IndexTypeValues.spoken_word
);
return indexJob;
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class IndexJob extends Job<NoDataResponse, NoDataResponse> {
* On sucess, it calls the index endpoint
*/
public start = async () => {
if (this.indexConfig.indexType === IndexTypeValues.spoken) {
if (this.indexConfig.indexType === IndexTypeValues.spoken_word) {
const transcriptJob = new TranscriptJob(this.vhttp, this.videoId);
const reqData = fromCamelToSnake(this.indexConfig);
transcriptJob.on('success', async () => {
Expand Down