Disable full-text search until we can go to arbitrary messages

This commit is contained in:
Scott Nonnenberg 2019-03-08 16:29:48 -08:00
parent b3ac1373fa
commit 031b64a476

View file

@ -2,9 +2,11 @@ import { omit, reject } from 'lodash';
import { normalize } from '../../types/PhoneNumber';
import { trigger } from '../../shims/events';
import { getMessageModel } from '../../shims/Whisper';
import { cleanSearchTerm } from '../../util/cleanSearchTerm';
import { searchConversations, searchMessages } from '../../../js/modules/data';
// import { getMessageModel } from '../../shims/Whisper';
// import { cleanSearchTerm } from '../../util/cleanSearchTerm';
import {
searchConversations /*, searchMessages */,
} from '../../../js/modules/data';
import { makeLookup } from '../../util/makeLookup';
import {
@ -97,9 +99,9 @@ async function doSearch(
): Promise<SearchResultsPayloadType> {
const { regionCode, ourNumber, noteToSelf } = options;
const [discussions, messages] = await Promise.all([
const [discussions /*, messages */] = await Promise.all([
queryConversationsAndContacts(query, { ourNumber, noteToSelf }),
queryMessages(query),
// queryMessages(query),
]);
const { conversations, contacts } = discussions;
@ -108,7 +110,7 @@ async function doSearch(
normalizedPhoneNumber: normalize(query, { regionCode }),
conversations,
contacts,
messages: getMessageProps(messages) || [],
messages: [], // getMessageProps(messages) || [],
};
}
function clearSearch(): ClearSearchActionType {
@ -144,27 +146,27 @@ function startNewConversation(
// Helper functions for search
const getMessageProps = (messages: Array<MessageType>) => {
if (!messages || !messages.length) {
return [];
}
// const getMessageProps = (messages: Array<MessageType>) => {
// if (!messages || !messages.length) {
// return [];
// }
return messages.map(message => {
const model = getMessageModel(message);
// return messages.map(message => {
// const model = getMessageModel(message);
return model.propsForSearchResult;
});
};
// return model.propsForSearchResult;
// });
// };
async function queryMessages(query: string) {
try {
const normalized = cleanSearchTerm(query);
// async function queryMessages(query: string) {
// try {
// const normalized = cleanSearchTerm(query);
return searchMessages(normalized);
} catch (e) {
return [];
}
}
// return searchMessages(normalized);
// } catch (e) {
// return [];
// }
// }
async function queryConversationsAndContacts(
providedQuery: string,