Skip to content
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

[98] add query for curator comments #154

Merged
merged 16 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Cleanup code + remove console.log
  • Loading branch information
stanislaw-zakrzewski committed Oct 18, 2024
commit 997b6a1c11f2898407d5d3426fbeaba36a97d3d3
Original file line number Diff line number Diff line change
@@ -179,7 +179,6 @@ export default function SearchBar({
return 'Incorrect entry. ":" characters have been removed. Please use filters instead.';
} else {
const quoteCount = decodeURI(searchInput).split('"').length - 1;
console.log(searchInput, quoteCount);
if (quoteCount % 2 !== 0) {
return 'Incorrect entry. Please make sure you have an even number of quotes.';
}
32 changes: 12 additions & 20 deletions verification/curator-service/ui/src/components/ViewCase.tsx
Original file line number Diff line number Diff line change
@@ -966,36 +966,28 @@ function RowContent(props: {
linkComment?: string;
}): JSX.Element {
const searchQuery = useSelector(selectSearchQuery);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const searchQueryArray: any[] = [];
const searchQueryArray: string[] = [];

function words(s: string) {
if (s.startsWith('?q=')) {
s = s.substring(3)
}
const quoted: string[] = []
const notQuoted: string[] = []
if (s.includes('"') && s.replace(/[^"]/g, "").length % 2 !== 1) {
s.split('"').map((subs: string, i: number) => {
if (i % 2) {
if (subs != "") quoted.push(subs)
} else {
if (subs != "") notQuoted.push(subs)
}
if (s.startsWith('?q=')) s = s.substring(3);

const quoted: string[] = [];
const notQuoted: string[] = [];
if (s.includes('"') && s.replace(/[^"]/g, '').length % 2 !== 1) {
s.split('"').map((subs: string, i: number) => {
subs != '' && i % 2 ? quoted.push(subs) : notQuoted.push(subs);
});
} else {
notQuoted.push(s)
}
const regex = /"([^"]+)"|(\w{1,})/g;
} else notQuoted.push(s);

const regex = /"([^"]+)"|(\w{1,})/g;
// Make sure that terms in quotes will be highlighted as one search term
for (const quotedEntry of quoted) {
let match;
let accumulator = [];
let accumulator: string[] = [];
while ((match = regex.exec(quotedEntry))) {
accumulator.push(match[match[1] ? 1 : 2]);
}
searchQueryArray.push(accumulator.join(' '))
searchQueryArray.push(accumulator.join(' '));
}
for (const notQuotedEntry of notQuoted) {
let match;