diff --git a/src/database.js b/src/database.js
index b2c9ca7..5ca43be 100644
--- a/src/database.js
+++ b/src/database.js
@@ -16,7 +16,8 @@ export function alasql_async_queries(alasql_object, queries) {
var p = Promise.resolve(null);
for (let i = 0; i < queries.length; i++) {
p = p.then(() => {
- return alasql_object.promise(queries[i]);
+ console.log(queries[i]);
+ return alasql_object.promise(queries[i]);
});
}
diff --git a/src/queries.js b/src/queries.js
index c89d308..87d30c3 100644
--- a/src/queries.js
+++ b/src/queries.js
@@ -143,7 +143,7 @@ export class MatchingFilter extends ResultFilter {
} else if (this.match_type == MatchTypeEnum.MATCH_IMAGE_NAME_NATURAL) {
return '(LOWER(Images.name) REGEXP LOWER(".*'
+ escape_regex(this.match_from)
- + ')).*"';
+ + '.*"))';
} else if (this.match_type == MatchTypeEnum.MATCH_ALBUM_EQUALS) {
return '(Albums.relativePath = "' + this.match_from + '")';
} else if (this.match_type == MatchTypeEnum.MATCH_ALBUM_EQUALS_OR_CHILD) {
@@ -153,9 +153,10 @@ export class MatchingFilter extends ResultFilter {
} else if (this.match_type == MatchTypeEnum.MATCH_ALBUM_NATURAL) {
throw new Error("Natural matching on album names is not yet supported.");
} else if (this.match_type == MatchTypeEnum.MATCH_ALBUM_NAME_EQUALS) {
- return '(Albums.relativePath REGEXP "\/(.*\/)*'
- + escape_regex(this.match_from)
- + '(\/[^\/]+)*")';
+ console.log('(Albums.relativePath REGEXP "\/(.*\/)*'
+ + escape_regex(this.match_from) + '")');
+ return '(Albums.relativePath REGEXP "' + escape_regex(this.match_from) + '")';
+ //+ '(\/[^\/]+)*")';
} else if (this.match_type == MatchTypeEnum.MATCH_TAG_EQUALS) {
return '(Tags.name="' + this.match_from + '")';
}
@@ -309,7 +310,7 @@ function filter_from_text_segment(result_type, segment) {
name_filter = new MatchingFilter(
result_type,
segment['text'],
- MatchTypeEnum.MATCH_TAG_NAME_EQUALS
+ MatchTypeEnum.MATCH_TAG_EQUALS
);
filter = name_filter;
if (segment['negated']) {
diff --git a/src/userquerywidget.js b/src/userquerywidget.js
index d4f5733..0b9cfc1 100644
--- a/src/userquerywidget.js
+++ b/src/userquerywidget.js
@@ -3,10 +3,12 @@ import React from 'react';
import Switch from '@material-ui/core/Switch';
import Box from '@material-ui/core/Box';
import FormControlLabel from '@material-ui/core/FormControlLabel';
-import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import LabelIcon from '@material-ui/icons/Label';
+import ImportContactsIcon from '@material-ui/icons/ImportContacts';
+import PhotoIcon from '@material-ui/icons/Photo';
+import SearchIcon from '@material-ui/icons/Search';
import { makeStyles } from '@material-ui/core/styles';
@@ -32,19 +34,59 @@ const useStyles = makeStyles(theme => ({
export function TagEqualsExpressionControl(props) {
const classes = useStyles();
const { name } = props;
+ return (
+ <>
+ }>
+ {name}
+
+ >
+ );
+}
- var pretty_name = name
- .replace(/^"/g, '')
- .replace(/"$/g, '');
+export function AlbumEqualsExpressionControl(props) {
+ const classes = useStyles();
+ const { name } = props;
+ return (
+ <>
+ }>
+ {name}
+
+ >
+ );
+}
+export function ImageNameEqualsExpressionControl(props) {
+ const classes = useStyles();
+ const { name } = props;
return (
<>
- }>
- {pretty_name}
-
+ }>
+ {name}
+
+ >
+ );
+}
+
+export function ImageNameNaturalMatchExpressionControl(props) {
+ const classes = useStyles();
+ const { name } = props;
+ return (
+ <>
+
>
);
}
@@ -53,26 +95,24 @@ export function MatchingFilterExpressionControl(props) {
const classes = useStyles();
const { expr } = props;
- if(expr.match_type === MatchTypeEnum.MATCH_EQUALS &&
- expr.match_against === "Tags.name") {
- // This is an exact tag match.
- return
+ var pretty_name = expr.match_from
+ .replace(/^"/g, '')
+ .replace(/"$/g, '');
+ if (expr.match_type === MatchTypeEnum.MATCH_TAG_EQUALS) {
+ return
+ } else if (expr.match_type === MatchTypeEnum.MATCH_ALBUM_EQUALS) {
+ return
+ } else if (expr.match_type === MatchTypeEnum.MATCH_ALBUM_EQUALS_OR_CHILD) {
+ return
+ } else if (expr.match_type === MatchTypeEnum.MATCH_IMAGE_NAME_EQUALS) {
+ return
+ } else if (expr.match_type === MatchTypeEnum.MATCH_IMAGE_NAME_NATURAL) {
+ return
+ } else if (expr.match_type === MatchTypeEnum.MATCH_ALBUM_NAME_EQUALS) {
+ return
}
- var opstr = "";
- if (expr.match_type === MatchTypeEnum.MATCH_EQUALS) {
- opstr = " = ";
- } else if (expr.match_type === MatchTypeEnum.MATCH_REGEXP_CASEINSENSITIVE) {
- opstr = " ≈ ";
- }
-
- var negstr = expr.negate ? "!" : "";
-
- return (
-
- );
+ throw new Error('Cannot render matching filter control: unsupported type.');
}
export function LogicalOperatorFilterExpressionControl(props) {
@@ -160,13 +200,9 @@ export function FilterControl(props) {
color="primary"
/>
}
- label={resultTypeString}
+ label={resultTypeString + ':'}
/>
-
- Filters:
-
-
-
+
>
);