mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #28392 from overleaf/dp-segment-editor-analytics
Add editor-redesign segmentation to a bunch of analytics events GitOrigin-RevId: e8d2091028dab09de06362c38c5a17f32253e7cc
This commit is contained in:
+6
-2
@@ -111,7 +111,11 @@ const FullProjectSearchUI: FC = () => {
|
||||
|
||||
await projectSnapshot.refresh()
|
||||
if (!abortControllerRef.current.signal.aborted) {
|
||||
const results = await searchSnapshot(projectSnapshot, searchQuery)
|
||||
const results = await searchSnapshot(
|
||||
projectSnapshot,
|
||||
searchQuery,
|
||||
newEditor
|
||||
)
|
||||
setMatchedFiles(results)
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -121,7 +125,7 @@ const FullProjectSearchUI: FC = () => {
|
||||
setLoading(false)
|
||||
}
|
||||
},
|
||||
[openDocs, projectSnapshot, t]
|
||||
[openDocs, projectSnapshot, t, newEditor]
|
||||
)
|
||||
|
||||
const searchInputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { RegExpCursor, SearchCursor, SearchQuery } from '@codemirror/search'
|
||||
import { ProjectSnapshot } from '@/infrastructure/project-snapshot'
|
||||
import { categorizer, regexpWordTest, stringWordTest } from './search'
|
||||
import { sendSearchEvent } from '@/features/event-tracking/search-events'
|
||||
import { populateEditorRedesignSegmentation } from '@/shared/hooks/use-editor-analytics'
|
||||
|
||||
export type Hit = {
|
||||
lineIndex: number
|
||||
@@ -20,7 +21,8 @@ const toLowerCase = (string: string) => string.toLowerCase()
|
||||
|
||||
export const searchSnapshot = async (
|
||||
projectSnapshot: ProjectSnapshot,
|
||||
searchQuery: SearchQuery
|
||||
searchQuery: SearchQuery,
|
||||
newEditor: boolean
|
||||
) => {
|
||||
if (!searchQuery.search.trim().length) {
|
||||
return
|
||||
@@ -82,11 +84,17 @@ export const searchSnapshot = async (
|
||||
a.path.localeCompare(b.path)
|
||||
)
|
||||
|
||||
sendSearchEvent('search-execute', {
|
||||
searchType: 'full-project',
|
||||
totalDocs: docPaths.length,
|
||||
totalResults: results.flatMap(file => file.hits).length,
|
||||
})
|
||||
sendSearchEvent(
|
||||
'search-execute',
|
||||
populateEditorRedesignSegmentation(
|
||||
{
|
||||
searchType: 'full-project',
|
||||
totalDocs: docPaths.length,
|
||||
totalResults: results.flatMap(file => file.hits).length,
|
||||
},
|
||||
newEditor
|
||||
)
|
||||
)
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user