Compare commits
2 Commits
b12c31099c
...
a09280f915
| Author | SHA1 | Date |
|---|---|---|
|
|
a09280f915 | |
|
|
e882a41510 |
|
|
@ -17,6 +17,7 @@ interface ParagraphDoc {
|
|||
id?: string
|
||||
document_id: string
|
||||
text: string
|
||||
raw?: string
|
||||
number: number
|
||||
locale: string
|
||||
type: string
|
||||
|
|
@ -327,6 +328,7 @@ function normalize(s: string): string {
|
|||
// ---- Refs de estado ---------------------------------------------------------
|
||||
|
||||
const paragraphsContainer = ref<HTMLElement | null>(null)
|
||||
const scrollContainer = ref<HTMLElement | null>(null)
|
||||
|
||||
// 'typesense' = Estado 1 (server-driven), 'local' = Estado 2 (client-driven)
|
||||
type SearchMode = 'typesense' | 'local'
|
||||
|
|
@ -481,9 +483,11 @@ async function applyTypesenseHighlights() {
|
|||
matchElements.value = domMarks
|
||||
currentMatchIdx.value = 0
|
||||
|
||||
// Paso 4: scroll — solo cuando hay hits de Typesense que ubican el párrafo correcto.
|
||||
// Sin hits, los marks se muestran para que el usuario navegue, pero no se hace scroll.
|
||||
if (!hasMatchingHits) return
|
||||
// Paso 4: scroll — sin hits (browse mode) volver al inicio; con hits, ir al párrafo correcto.
|
||||
if (!hasMatchingHits) {
|
||||
if (scrollContainer.value) scrollContainer.value.scrollTop = 0
|
||||
return
|
||||
}
|
||||
|
||||
let targetMark: HTMLElement | null = snippetMarks[0] ?? null
|
||||
|
||||
|
|
@ -856,7 +860,7 @@ function highlightTextNodes(root: HTMLElement, terms: string[]): number {
|
|||
<div class="">
|
||||
<div
|
||||
class="paragraph-html text-sm leading-relaxed text-gray-800 dark:text-gray-200"
|
||||
v-html="hit.document.raw"
|
||||
v-html="hit.document.raw || hit.document.text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { breakpointsTailwind, useDebounce } from '@vueuse/core'
|
|||
import EstudiosTypensenseDetail from '~/components/estudiosTypensense/EstudiosTypensenseDetail.vue'
|
||||
import { useSettingsStore } from '~/stores/settings'
|
||||
|
||||
const PARAGRAPHS_COLLECTION = 'paragraphs'
|
||||
const DOCUMENTS_COLLECTION = 'documents'
|
||||
const PARAGRAPHS_COLLECTION = 'conferences_paragraphs'
|
||||
const CONFERENCES_COLLECTION = 'conferences'
|
||||
const QUERY_BY = 'text'
|
||||
const FAVORITES_COLLECTION = 'conferences-ts'
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ async function fetchDocumentMeta(docIds: string[]) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: CONFERENCES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: `id:=[${unique.join(',')}]`,
|
||||
|
|
@ -313,7 +313,7 @@ async function runBrowse(page = 1, append = false) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: CONFERENCES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: filterBy.value,
|
||||
|
|
@ -444,7 +444,7 @@ async function fetchFullDocument(docId: string) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: CONFERENCES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: `id:=${docId}`,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { breakpointsTailwind, useDebounce } from '@vueuse/core'
|
|||
import EstudiosTypensenseDetail from '~/components/estudiosTypensense/EstudiosTypensenseDetail.vue'
|
||||
import { useSettingsStore } from '~/stores/settings'
|
||||
|
||||
const PARAGRAPHS_COLLECTION = 'paragraphs'
|
||||
const DOCUMENTS_COLLECTION = 'documents'
|
||||
const PARAGRAPHS_COLLECTION = 'activities_paragraphs'
|
||||
const ACTIVITIES_COLLECTION = 'activities'
|
||||
const QUERY_BY = 'text'
|
||||
const FAVORITES_COLLECTION = 'bible-studies-ts'
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ async function fetchDocumentMeta(docIds: string[]) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: ACTIVITIES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: `id:=[${unique.join(',')}]`,
|
||||
|
|
@ -314,7 +314,7 @@ async function runBrowse(page = 1, append = false) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: ACTIVITIES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: filterBy.value,
|
||||
|
|
@ -444,7 +444,7 @@ async function fetchFullDocument(docId: string) {
|
|||
multiSearchParameters: {},
|
||||
multiSearchSearchesParameter: {
|
||||
searches: [{
|
||||
collection: DOCUMENTS_COLLECTION,
|
||||
collection: ACTIVITIES_COLLECTION,
|
||||
q: '*',
|
||||
queryBy: 'title',
|
||||
filterBy: `id:=${docId}`,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export default defineNuxtConfig({
|
|||
|
||||
typesense: {
|
||||
url: 'https://searchts.carpa.com', // Your Typesense server URL
|
||||
apiKey: 'a2lbIMTxh48KVteLLndpBfo4tuOIGiwD', // Your Typesense API key
|
||||
apiKey: 'ULcypm8VYP2vgQkN57CuUqSFypWaR6ox', // Your Typesense API key
|
||||
// Habilita los composables auto-importados en cliente
|
||||
// (useTypesenseDocuments, useTypesenseApi, etc.).
|
||||
// ⚠️ Solo usa una clave de búsqueda (search-only) aquí: queda expuesta al navegador.
|
||||
|
|
|
|||
Loading…
Reference in New Issue