@@ -240,7 +240,7 @@ export function navigateToSearch(sessionId, locString, trackId, isValidRefNameFo
240240 const start = parsedLocString . start ;
241241 const end = parsedLocString . end ;
242242
243- searchString = serializeLocationToLuceneQuery ( contig , start , end )
243+ searchString = serializeLocationToEncodedSearchString ( contig , start , end )
244244 }
245245
246246 window . location . href = ActionURL . buildURL ( "jbrowse" , "variantSearch.view" , null , { session : sessionId , location : locString , trackId : trackId , activeTracks : trackId , sampleFilters : sampleFilterURL , infoFilters : infoFilterURL , searchString : searchString } )
@@ -318,7 +318,7 @@ export function getGenotypeURL(trackId, contig, start, end) {
318318 return ActionURL . buildURL ( "jbrowse" , "genotypeTable.view" , null , { trackId : trackId , chr : contig , start : start , stop : end } )
319319}
320320
321- export function serializeLocationToLuceneQuery ( contig , start , end ) {
321+ export function serializeLocationToEncodedSearchString ( contig , start , end ) {
322322 const filters = [
323323 new Filter ( "contig" , OperatorKey . Equals , contig . toString ( ) ) ,
324324 new Filter ( "start" , OperatorKey . NumericGte , start . toString ( ) ) ,
@@ -348,6 +348,9 @@ export async function fetchLuceneQuery(filters, sessionId, trackGUID, offset, pa
348348 return
349349 }
350350
351+ const lucene = buildLuceneQuery ( filters )
352+ const encoded = encodeURIComponent ( lucene )
353+
351354 let sortReverse ;
352355 if ( sortReverseString == "asc" ) {
353356 sortReverse = true
@@ -366,7 +369,7 @@ export async function fetchLuceneQuery(filters, sessionId, trackGUID, offset, pa
366369 failureCallback ( "There was an error: " + res . status + "\n Status Body: " + res . responseText + "\n Session ID:" + sessionId )
367370 } ,
368371 params : {
369- "searchString" : buildLuceneQuery ( filters ) ,
372+ "searchString" : encoded ,
370373 "sessionId" : sessionId ,
371374 "trackId" : trackGUID ,
372375 "offset" : offset ,
@@ -513,11 +516,11 @@ export function createEncodedFilterString(filters: Filter[]): string {
513516}
514517
515518export function buildLuceneQuery ( filters : Filter [ ] ) : string {
516- if ( ! filters . length || filters . every ( f => f . isEmpty ( ) ) ) return 'all'
517- return filters
518- . filter ( f => ! f . isEmpty ( ) )
519- . map ( f => f . toLucene ( ) )
520- . join ( '&' )
519+ if ( ! filters . length || filters . every ( f => f . isEmpty ( ) ) ) return 'all'
520+ return filters
521+ . filter ( f => ! f . isEmpty ( ) )
522+ . map ( f => f . toLucene ( ) )
523+ . join ( '&' )
521524}
522525
523526export async function fetchFieldTypeInfo ( sessionId : string , trackId : string , successCallback : ( fields : FieldModel [ ] , groups : string [ ] , promotedFilters : Map < string , Filter [ ] > ) => void , failureCallback ) {
0 commit comments